haskell / mwc-random

A very fast Haskell library for generating high quality pseudo-random numbers.
http://hackage.haskell.org/package/mwc-random
BSD 2-Clause "Simplified" License
55 stars 25 forks source link

Benchmarks and performance improvements for binomial #95

Closed Shimuuar closed 2 months ago

Shimuuar commented 3 months ago

This PR improves performance of binomial with 10-50% speedups with larger gains for BINV algorithm. Mostly optimizations were adding strictness and avoiding allocations.

@idontgetoutmuch it seems using larger than 10 threshold would be more efficient but didn't make necessary measurements for picking better one. So I left it as is. I plan to make release once this PR is merged

Shimuuar commented 2 months ago

mwc-random-0.15.1.0 is on hackage. Sorry for the wait

idontgetoutmuch commented 2 months ago

mwc-random-0.15.1.0 is on hackage. Sorry for the wait

No problem - it's been fun working with you :-)