-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notes: 32-bit implementation and perf optimization #5
Comments
Raw benchmark numbers:
|
This table shows operations per second normalized to core's implementation as 1. >1 means faster than core by that factor. The columns represent the old version of PCG, the new algorithm, and the new algorithm with hand-optimized JS.
Takeaway: The new version of PCG will always be faster than core, even without the compiler inlining bitwise ops and Tiny caveat: I haven't implemented independent seeds (aka splitting) yet, which I expect to slow things down slightly. Unless we want to add that feature to core or want to take the (small) perf hit for being able to do so later easily, it won't be included in a PR to core. But, that doesn't need to happen right away. If 0.18 is going to be about breaking things now instead of later, this can be delayed because it doesn't change the interface. At all. One of the side benefits of only 32 bits of state is that |
This is really great! 🚀 Awesome work @mgold! I'd say including |
Okay, I've implemented |
Implemented in 3.0.0. |
Tests run on mgold/elm-nonempty-list test suite commit
9fe70d9
unless otherwise noted. Unreleased PCG versions were hand-copied intoelm-stuff
.peel
implementation%
no longer buried in function callselm-check
,c8c83c2
elm-check
,c8c83c2
with property-based tests removed85228d5
Observations: With project-fuzzball, there's about 200ms of overhead and either RNG adds another 1.5 to 2 seconds. With elm-check, it takes 30ms.
I was really confused as to what Hassan was doing until I realized that the 30ms figure doesn't include the time to run the property-based tests! It's a completely invalid comparison!
The currently shipping PCG is about twice as slow as core/Random, but PCG-32 is only slightly slower, probably good enough to use. Plus, it will get even faster if bitwise op inlining is ever implemented by the compiler.
One possible flaw is that PCG-32 was measured against project-fuzzball/test version 1.x while core was against 5.x. Were there any major performance changes in the interceding versions?
Hand optimized JS:
The text was updated successfully, but these errors were encountered: