digitalmars.D.learn - Parallelizing factorial computation
- Uknown (10/10) Aug 24 2018 I was messing and tried comparing the performance of different
- Peter Alexander (4/7) Aug 24 2018 n = 100 is too small to see parallelism gains.
- Uknown (4/11) Aug 24 2018 I was using n = 10000 originally, I reduced it because that
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?
Aug 24 2018
On Friday, 24 August 2018 at 13:04:47 UTC, Uknown wrote:I was quite surprised by the fact that parallel ran so much slower than recursive and loop implementations. Does anyone know why?n = 100 is too small to see parallelism gains. Try n = 10000 https://run.dlang.io/is/XDZTSd
Aug 24 2018
On Friday, 24 August 2018 at 20:43:46 UTC, Peter Alexander wrote:On Friday, 24 August 2018 at 13:04:47 UTC, Uknown wrote:I was using n = 10000 originally, I reduced it because that wasn't running on run.dlang. Tried this again on my machine and you were right.I was quite surprised by the fact that parallel ran so much slower than recursive and loop implementations. Does anyone know why?n = 100 is too small to see parallelism gains. Try n = 10000 https://run.dlang.io/is/XDZTSd
Aug 24 2018