Last active
October 19, 2020 17:26
-
-
Save nh2/fa707e43791ab9abf4032bce8f2eb6ca to your computer and use it in GitHub Desktop.
Repro for GHC making crazy amounts of slop with +RTS -N2, see https://gitlab.haskell.org/ghc/ghc/-/issues/18849
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Run with: | |
-- ghc --make -O -threaded -fforce-recomp SlopProblem.hs && command time ./SlopProblem +RTS -N1 -s | |
-- | |
-- My output with ghc 8.6.5 on a 4-core machine: | |
-- ... | |
-- 336,707,456 bytes maximum residency (14 sample(s)) | |
-- 611,774,592 bytes maximum slop | |
-- ... | |
-- ... 1716344maxresident)k | |
-- The slop reduces to 1 MB when `-N1` is used, and the resident memory usage | |
-- measured by `time` reduces from 1.7 GB to 0.6 GB. | |
import qualified Data.Vector as V | |
data WordTuple = WordTuple {-# UNPACK #-} !Int {-# UNPACK #-} !Int | |
main :: IO () | |
main = do | |
putStrLn "Measuring 1M WordTuples" | |
V.fromList | |
[ WordTuple (fromIntegral (i+1)) (fromIntegral (i+2)) | |
| i <- [1..10000000::Int] | |
] | |
`seq` | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment