Skip to content

Instantly share code, notes, and snippets.

@AdamStelmaszczyk
Last active June 8, 2017 16:42
Show Gist options
  • Save AdamStelmaszczyk/81c443191b25a73e868d56ae3cae0994 to your computer and use it in GitHub Desktop.
Save AdamStelmaszczyk/81c443191b25a73e868d56ae3cae0994 to your computer and use it in GitHub Desktop.
How to optimize this Haskell code summing up the primes?
Thu Jun 8 18:42 2017 Time and Allocation Profiling Report (Final)
10 +RTS -p -RTS
total time = 7.79 secs (7786 ticks @ 1000 us, 1 processor)
total alloc = 6,259,859,408 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
p.sieve.update.decrease Main 52.2 67.5
p.sieve.update.sumOfSieved Main 36.3 11.3
p.sieve.update Main 8.0 16.8
p.sieve.update.\ Main 1.4 2.0
p Main 1.4 1.9
individual inherited
COST CENTRE MODULE no. entries %time %alloc %time %alloc
MAIN MAIN 47 0 0.0 0.0 100.0 100.0
CAF Main 93 0 0.0 0.0 100.0 100.0
main Main 94 1 0.0 0.0 100.0 100.0
p Main 95 1 1.4 1.9 100.0 100.0
p.v Main 98 1 0.2 0.2 0.2 0.2
p.r Main 97 1 0.0 0.0 0.0 0.0
p.sieve Main 96 44721 0.7 0.3 98.5 97.8
p.sieve.update Main 99 4648 8.0 16.8 97.8 97.5
p.sieve.update.\ Main 101 5038941 1.4 2.0 37.7 13.3
p.sieve.update.sumOfSieved Main 102 1921602 36.3 11.3 36.3 11.3
p.sieve.update.decrease Main 100 5038941 52.2 67.5 52.2 67.5
CAF GHC.IO.Handle.FD 87 0 0.0 0.0 0.0 0.0
CAF GHC.Conc.Signal 84 0 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding 80 0 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding.Iconv 68 0 0.0 0.0 0.0 0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment