Benchmarks show no garbage collection taking place (may that be hidden?).
julia> @benchmark (@sync for n in t | julia> @benchmark pmap(n->slow(n), t) seconds=100
Threads.@spawn slow(n) |
end) seconds=100 |
BenchmarkTools.Trial: | BenchmarkTools.Trial:
memory estimate: 123.39 KiB | memory estimate: 477.23 KiB
allocs estimate: 1378 | allocs estimate: 12356
-------------- | --------------
minimum time: 13.207 s (0.00% GC) | minimum time: 11.686 s (0.00% GC)
median time: 13.588 s (0.00% GC) | median time: 12.136 s (0.00% GC)
mean time: 13.535 s (0.00% GC) | mean time: 12.075 s (0.00% GC)
maximum time: 13.726 s (0.00% GC) | maximum time: 12.427 s (0.00% GC)
-------------- | --------------
samples: 8 | samples: 9
evals/sample: 1 | evals/sample: 1
The times here are not realistic due to thermal throttling but still show the difference.