Skip to content

Conversation

@telser
Copy link
Contributor

@telser telser commented Sep 22, 2025

A tiny fix, that tested on a closed-source codebase of over 16k modules took formatting inplace from ~10.5 minutes to ~19seconds.

This fixes #1176

A tiny fix, that tested on a closed-source codebase of over 16k
modules took formatting inplace from ~10.5 minutes to ~19seconds.
Copy link
Member

@amesgen amesgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, a fun/depressing example how the Applicative instance of tuples can be misleading. It probably was introduced while refactoring in #1129 from modifyMVar_ to atomicModifyIORef (where the pure was (correctly) using IO) near the end of the review process. 😬

Essentially, the previous behavior always kept the cache to be the empty Map (as that is mempty for Map which is used for the first tuple component by pure). Semantically, this reverted #915, which we know is very important for performance in large projects (#897).


In the future, we might want to introduce automatic benchmarks in every PR that are mandatory to pass before a PR is merged, to avoid such subtle bugs from sneaking in.

@mrkkrp mrkkrp merged commit 801a844 into tweag:master Sep 23, 2025
7 checks passed
@mrkkrp
Copy link
Member

mrkkrp commented Sep 23, 2025

Thanks! I will proceed with a new release (0.8.0.2) shortly.

@telser
Copy link
Contributor Author

telser commented Sep 23, 2025

Thanks a lot, a fun/depressing example how the Applicative instance of tuples can be misleading. It probably was introduced while refactoring in #1129 from modifyMVar_ to atomicModifyIORef (where the pure was (correctly) using IO) near the end of the review process. 😬

It is a very good example of that!

Thanks! I will proceed with a new release (0.8.0.2) shortly.

Thanks to both of you @mrkkrp and @amesgen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Big slowdown with 0.8 in "large" repo

3 participants