-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add Farm Hash conditioned upon nimPreviewHashFarm
as 64-bit Hash
#23735
Conversation
actually filling hash function for `string` & related. For the curious, note that `hashData` remains the aboriginal Nim string hasher & `import hashes {.all.}` allows simultaneous test/time of {orig, murmur, farm} on your favorite CPU & back end compiler. Update tests also conditioned upon `nimPreviewHashFarm` so they should pass either with or without that `define` on. In `--jsbigint=on` mode, only the lower 32-bits of `Hash` match nimvm & run-time values because `type Hash = int` and on JS int=int32, not int64 as for 64-bit Nim platforms. Due to the matching, `const` Table should match run-time `Table` on all platforms. To operate in `--jsbigint=off` mode is feasible but needs much "double precision mul/xor/ror/shr-arithmetic"-style work. That is distracting & also of questionable value since JS added BigInt in 2018, ringabout added Nim support for it in 2021 & `nimPreviewHashFarm` is unlikely to swap from an opt-in to an opt-out default before 2025..2026 which will have given a backward looking time window of 7..8 years for deployment platforms - reasonably generous. Add a changelog entry for 2.2.
Cross ref to #23678 discussion. |
FWIW, the failing tests have nothing to do with this PR (although perhaps the non-deterministic 7 second timeout in |
Should |
Personally, I think |
and simplify/clarify the language a little while doing so.
We could even make it the default for 2.2 as long as it works with JavaScript out of the box too. (We need to make --jsbigint=on the default.) |
Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release |
The tests need to be enabled with |
Unlike present Nim this actually fills
Hash
forstring
& related.For the curious, note that
hashData
remains the aboriginal Nim string hasher &import hashes {.all.}
allows simultaneous test/time of {orig, murmur, farm} on your favorite CPU & back end compiler.Update tests also conditioned upon
nimPreviewHashFarm
so they should pass either with or without thatdefine
on.In
--jsbigint=on
mode, only the lower 32-bits ofHash
match nimvm & run-time values becausetype Hash = int
and on JS int=int32, not int64 as for 64-bit Nim platforms. Due to the matching,const
Table should match run-timeTable
on all platforms.To operate in
--jsbigint=off
mode is feasible but needs much "double precision mul/xor/ror/shr-arithmetic"-style work. That is distracting & also of questionable value since JS added BigInt in 2018, ringabout added Nim support for it in 2021 &nimPreviewHashFarm
is unlikely to swap from an opt-in to an opt-out default before 2025..2026 which will have given a backward looking time window of 7..8 years for deployment platforms - reasonably generous.Add a changelog entry for 2.2.