Last active
October 19, 2020 17:26
-
-
Save nh2/fa707e43791ab9abf4032bce8f2eb6ca to your computer and use it in GitHub Desktop.
Revisions
-
nh2 revised this gist
Oct 19, 2020 . No changes.There are no files selected for viewing
-
nh2 revised this gist
Oct 15, 2020 . 1 changed file with 9 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,35 +1,27 @@ -- 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 () -
nh2 created this gist
Oct 15, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ -- Run with: -- ghc --make -O -threaded -fforce-recomp SlopProblem.hs && ./SlopProblem +RTS -N2 -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 -- ... -- The slop reduces to 1 MB when `-N1` is used. {-# LANGUAGE DeriveGeneric #-} import Control.DeepSeq import Control.Exception import qualified Data.Vector as V import Data.Word import GHC.Generics data WordTuple = WordTuple {-# UNPACK #-} !Word64 {-# UNPACK #-} !Word64 deriving (Eq, Ord, Show, Generic) instance NFData WordTuple main :: IO () main = do putStrLn "Measuring 1M triples" _ <- evaluate $ force $ V.fromList [ WordTuple (fromIntegral (i+1)) (fromIntegral (i+2)) | i <- [1..10000000::Int] ] return ()