Skip to content

Commit 7ba870c

Browse files
telsermrkkrp
authored andcommitted
Fix performance regression
A tiny fix, that tested on a closed-source codebase of over 16k modules took formatting inplace from ~10.5 minutes to ~19seconds.
1 parent e92a724 commit 7ba870c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Unreleased
2+
3+
* Fixed a performance regression introduced in 0.8.0.0. [Issue
4+
1176](https://github.com/tweag/ormolu/issues/1176).
5+
16
## Ormolu 0.8.0.1
27

38
* Correctly format edge cases where fully collapsing string gaps changes the
@@ -9,7 +14,7 @@
914
1166](https://github.com/tweag/ormolu/issues/1166).
1015

1116
* Make multiline function signatures in RequiredTypeArguments consistent with
12-
types [PR 1170](https://github.com/tweag/ormolu/pull/1170)
17+
types [PR 1170](https://github.com/tweag/ormolu/pull/1170).
1318

1419
* Correctly format single-line `MultiWayIf`s. [Issue
1520
1171](https://github.com/tweag/ormolu/issues/1171).

src/Ormolu/Utils/IO.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module Ormolu.Utils.IO
1010
where
1111

1212
import Control.Exception (catch, throwIO)
13-
import Control.Monad (void)
1413
import Control.Monad.IO.Class
1514
import Data.IORef
1615
import Data.Map.Lazy (Map)
@@ -67,5 +66,5 @@ withCache (Cache cacheVar) k action = do
6766
Just v -> pure v
6867
Nothing -> do
6968
v <- action
70-
void $ atomicModifyIORef cacheVar (pure . M.insert k v)
69+
atomicModifyIORef cacheVar ((,()) . M.insert k v)
7170
pure v

0 commit comments

Comments
 (0)