I notice that when I run a criterion benchmark (which does no forkIO
or par
) compiled with -O2 -rtsopts -threaded -eventlog
and +RTS -N2 -ls
that real work (not just GC) is spread across both cores. A quick grep of the criterion source didn't show where the parallelism was originating.
I'd like to do some careful benchmarks measuring e.g. contentious updates on an MVar between two threads; can I do that accurately with criterion (for instance if all of that parallelism is happening between tests)?
I stuck a traceEventIO
before and after each IO action under test, and it looks entirely single-threaded for the duration of the test code execution, so I think I should be good.