haskell / criterion

A powerful but simple library for measuring the performance of Haskell code.
http://www.serpentine.com/criterion
BSD 2-Clause "Simplified" License
501 stars 86 forks source link

please document that (and how) criterion runs GC #272

Open jwaldmann opened 1 year ago

jwaldmann commented 1 year ago

I was running a benchmark with +RTS -Sstderr (trying to find a good -A.. value)

I was surprised to see heavy garbage collection going on - since I was expecting that my function does little allocation, and I put large +RTS -M.. -H.. values.

Then I read #257 (etc.) and deduced that criterion runs the collector. I understand the motivation - but it's not quite clear (to me) from the text at https://hackage.haskell.org/package/criterion-1.6.0.0/docs/Criterion-Main.html, where "garbage collection" is only mentioned in connection to "environments" - but my (very simple) benchmark does not use them.

jwaldmann commented 1 year ago

NB: gauge improves on this, their https://hackage.haskell.org/package/gauge-0.2.5/docs/Gauge-Main.html#v:defaultMainWith shows forceGC.