Performance comparison was done in a similar manner to the CPS WriterT patch, notes on the xhtml PR.
tl;dr:
12% reduction in memory use for the entire Haddock run
48% reduction in time for the ppHtml phase
While it seems kinda funny to care too much about "oh wow 600ms to 300ms wow wow", we've got some big re-export modules at work that currently take 33 seconds to generate, and ppHtml allocates over 800GB.
EDIT:
Correctness
OK, I've tested the Haddock generation by building haddock with this patch and with the ghc-9.4 branch. The generated HTML is identical, as tested by diff.
Performance
This time I'm using persistent instead of persistent-test because it has fewer steps to get perf output from.
Haddock ghc-9.4
This is built using haddock on the ghc-9.4 branch.
ppHtml: alloc=1134416896 time=380.667
15,979,133,408 bytes allocated in the heap
2,437,895,544 bytes copied during GC
238,259,312 bytes maximum residency (15 sample(s))
5,391,248 bytes maximum slop
554 MiB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 3797 colls, 0 par 1.224s 1.226s 0.0003s 0.0031s
Gen 1 15 colls, 0 par 0.875s 0.876s 0.0584s 0.1627s
TASKS: 5 (1 bound, 4 peak workers (4 total), using -N1)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.001s ( 0.000s elapsed)
MUT time 4.660s ( 5.192s elapsed)
GC time 2.099s ( 2.101s elapsed)
EXIT time 0.001s ( 0.007s elapsed)
Total time 6.761s ( 7.300s elapsed)
Alloc rate 3,428,870,682 bytes per MUT second
Productivity 68.9% of total user, 71.1% of total elapsed
Documentation created:
/home/matt/Projects/persistent/dist-newstyle/build/x86_64-linux/ghc-9.4.3/persistent-2.14.4.3/doc/html/persistent/index.html
HTML allocations: 1134 MB
HTML time: 380 ms
Total Memory: 554 MB
Total Allocated: 16.0 GB
Max residency: 238 MB
Total Time: 10.888 s
xhtml Builder
ppHtml: alloc=1140800792 time=197.762
15,973,532,640 bytes allocated in the heap
2,222,376,616 bytes copied during GC
195,984,808 bytes maximum residency (14 sample(s))
5,124,696 bytes maximum slop
466 MiB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 3727 colls, 0 par 1.203s 1.205s 0.0003s 0.0038s
Gen 1 14 colls, 0 par 0.662s 0.662s 0.0473s 0.1180s
TASKS: 5 (1 bound, 4 peak workers (4 total), using -N1)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.001s ( 0.000s elapsed)
MUT time 4.659s ( 5.183s elapsed)
GC time 1.865s ( 1.867s elapsed)
EXIT time 0.001s ( 0.010s elapsed)
Total time 6.526s ( 7.060s elapsed)
Alloc rate 3,428,220,794 bytes per MUT second
Productivity 71.4% of total user, 73.4% of total elapsed
Documentation created:
/home/matt/Projects/persistent/dist-newstyle/build/x86_64-linux/ghc-9.4.3/persistent-2.14.4.3/doc/html/persistent/index.html
Log printed to dist-newstyle/haddock-logs/13:04_2022-04-21_haddock-builder.txt
Used haddock: /home/matt/.cabal/bin/haddock-builder
I can't reproduce the performance, and when checking lately, I can't get this patch to be faster, at all. Going to close this out until I can figure out WTF is going on.
This PR uses the
Builder
patch to thexhtml
library.Performance comparison was done in a similar manner to the CPS WriterT patch, notes on the
xhtml
PR.tl;dr:
ppHtml
phaseWhile it seems kinda funny to care too much about "oh wow 600ms to 300ms wow wow", we've got some big re-export modules at work that currently take 33 seconds to generate, and
ppHtml
allocates over 800GB.EDIT:
Correctness
OK, I've tested the Haddock generation by building
haddock
with this patch and with theghc-9.4
branch. The generated HTML is identical, as tested bydiff
.Performance
This time I'm using
persistent
instead ofpersistent-test
because it has fewer steps to get perf output from.Haddock
ghc-9.4
This is built using
haddock
on theghc-9.4
branch.xhtml
BuilderFinal Performance Comparison:
Comparing these figures, we have:
xhtml
BuilderPretty pleased with these results.