[Haskell-cafe] Unnecessarily strict implementations
Jan Christiansen
jac at informatik.uni-kiel.de
Fri Sep 3 18:21:39 EDT 2010
On 03.09.2010, at 14:38, Daniel Fischer wrote:
> I can't reproduce that. For me, it leaks also with profiling.
Have you used optimizations? It disappears if I compile the program
with -O2.
Without profiling I get the following. Here the maximum residency is
nearly 45MB.
$ ghc --make Temp.hs -fforce-recomp
[1 of 1] Compiling Main ( Temp.hs, Temp.o )
Linking Temp ...
$ ./Temp +RTS -sstderr
./Temp +RTS -sstderr
5458199
647,520,792 bytes allocated in the heap
256,581,176 bytes copied during GC
44,934,408 bytes maximum residency (11 sample(s))
1,363,496 bytes maximum slop
103 MB total memory in use (1 MB lost due to
fragmentation)
Generation 0: 1223 collections, 0 parallel, 0.83s, 0.85s
elapsed
Generation 1: 11 collections, 0 parallel, 0.49s, 0.62s
elapsed
INIT time 0.00s ( 0.00s elapsed)
MUT time 0.63s ( 0.67s elapsed)
GC time 1.32s ( 1.46s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 1.96s ( 2.13s elapsed)
%GC time 67.6% (68.5% elapsed)
Alloc rate 1,022,883,082 bytes per MUT second
Productivity 32.3% of total user, 29.6% of total elapsed
With profiling it looks as follows. Here the maximum residency is less
than 15KB.
$ ghc --make Temp.hs -prof -auto-all -fforce-recomp
[1 of 1] Compiling Main ( Temp.hs, Temp.o )
Linking Temp ...
$ ./Temp +RTS -sstderr
./Temp +RTS -sstderr
5458199
1,051,844,836 bytes allocated in the heap
110,134,944 bytes copied during GC
14,216 bytes maximum residency (96 sample(s))
37,068 bytes maximum slop
2 MB total memory in use (0 MB lost due to
fragmentation)
Generation 0: 1908 collections, 0 parallel, 0.57s, 0.59s
elapsed
Generation 1: 96 collections, 0 parallel, 0.02s, 0.02s
elapsed
INIT time 0.00s ( 0.00s elapsed)
MUT time 1.46s ( 1.51s elapsed)
GC time 0.60s ( 0.61s elapsed)
RP time 0.00s ( 0.00s elapsed)
PROF time 0.00s ( 0.00s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 2.05s ( 2.12s elapsed)
%GC time 29.0% (28.7% elapsed)
Alloc rate 721,170,248 bytes per MUT second
Productivity 71.0% of total user, 68.9% of total elapsed
More information about the Haskell-Cafe
mailing list