summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-11-24 20:39:56 +0100
committerBen Gamari <ben@smart-cactus.org>2020-12-14 15:22:13 -0500
commitaf855ac1d37359df3db8c48dc6c9dd2f3fe24e77 (patch)
tree434a4cda6edcd19f282a1a38a9f2d864c1309b60 /testsuite/tests
parentd0e8c10d587e4b9984526d0dfcfcb258b75733b8 (diff)
downloadhaskell-af855ac1d37359df3db8c48dc6c9dd2f3fe24e77.tar.gz
Optimize dumping of consecutive whitespace.wip/andreask/opt_dumps
The naive way of putting out n characters of indent would be something like `hPutStr hdl (replicate n ' ')`. However this is quite inefficient as we allocate an absurd number of strings consisting of simply spaces as we don't cache them. To improve on this we now track if we can simply write ascii spaces via hPutBuf instead. This is the case when running with -ddump-to-file where we force the encoding to be UTF8. This avoids both the cost of going through encoding as well as avoiding allocation churn from all the white space. Instead we simply use hPutBuf on a preallocated unlifted string. When dumping stg like this: > nofib/spectral/simple/Main.hs -fforce-recomp -ddump-stg-final -ddump-to-file -c +RTS -s Allocations went from 1,778 MB to 1,702MB. About a 4% reduction of allocation! I did not measure the difference in runtime but expect it to be similar. Bumps the haddock submodule since the interface of GHC's Pretty slightly changed. ------------------------- Metric Decrease: T12227 -------------------------
Diffstat (limited to 'testsuite/tests')
0 files changed, 0 insertions, 0 deletions