Parallelizing factorial computation

Uknown sireeshkodali1 at gmail.com
Fri Aug 24 13:04:47 UTC 2018


I was messing and tried comparing the performance of different 
ways to compute the factorial of a number. Here's the benchmark 
results:

recursive:	244 ms, 283 μs, and 2 hnsecs
loop:		241 ms, 412 μs, and 3 hnsecs
parallel:	1 sec, 784 ms, 829 μs, and 5 hnsecs


https://run.dlang.io/is/uyVlqu

I was quite surprised by the fact that parallel ran so much 
slower than recursive and loop implementations. Does anyone know 
why?


More information about the Digitalmars-d-learn mailing list