summary refs log tree commit diff stats
path: root/changelog.md
diff options
context:
space:
mode:
authorc-blake <c-blake@users.noreply.github.com>2024-06-19 04:49:57 +0000
committerGitHub <noreply@github.com>2024-06-19 06:49:57 +0200
commite64512036289434c6a7b377f52a50189beae75e8 (patch)
tree89f6d7bec38553927602a42e6146065894c1139f /changelog.md
parent9d08d26e3307cf5d21271fd30d983f8d1c66ec50 (diff)
downloadNim-e64512036289434c6a7b377f52a50189beae75e8.tar.gz
Add Farm Hash conditioned upon `nimPreviewHashFarm` as 64-bit `Hash` (#23735)
Unlike present Nim this actually fills `Hash` 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.
Diffstat (limited to 'changelog.md')
-rw-r--r--changelog.md3
1 files changed, 3 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index 53d88b19f..92abb2614 100644
--- a/changelog.md
+++ b/changelog.md
@@ -39,6 +39,9 @@ slots when enlarging a sequence.
   objects the cyclic collector did free. If the number is zero that is a strong indicator that you can use `--mm:arc`
   instead of `--mm:orc`.
 - A `$` template is provided for `Path` in `std/paths`.
+- `nimPreviewHashFarm` has been added to `lib/pure/hashes.nim` to default to a
+64-bit string `Hash` (based upon Google's Farm Hash) which is also faster than
+the present one.  At present, this is incompatible with `--jsbigint=off` mode.
 
 [//]: # "Deprecations:"