summaryrefslogtreecommitdiff
path: root/utils
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 /utils
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 'utils')
m---------utils/haddock0
1 files changed, 0 insertions, 0 deletions
diff --git a/utils/haddock b/utils/haddock
-Subproject 284c9a0c304faf9c186421a62da5d8b4dc73a8a
+Subproject ef0375d6dc3d786c48067ecd6b84a58130829ac