Skip to content

v1.2.0

Choose a tag to compare

@orca-zhang orca-zhang released this 14 Nov 04:03

🚀 Faster string-key sharding with XXH3-64.

Changes

  • Replace the byte-at-a-time BKDR hash with github.com/zeebo/xxh3 v1.1.0 for string-key sharding.
  • Use xxh3.HashString directly, without allocating a byte slice. Long inputs automatically use SIMD on supported CPUs.
  • Add multi-shard Put/Get/Delete regression coverage for empty, UTF-8, and long keys in both LRU and LRU-2 modes.
  • Fix Semaphore CI startup by moving the runner image from unsupported Ubuntu 20.04 to Ubuntu 22.04.
  • Use HTTPS for the public repository checkout so CI does not depend on the invalid SSH deploy key.

Compatibility

Go 1.22 or later is now required, up from Go 1.14. The public cache API is unchanged.

Performance

Synthetic hot-cache GetBytes results on an Intel Xeon E5-2696 v4, Windows/amd64, Go 1.24; 256 shards and 4,096 keys. Values are medians of three runs; lower is better.

Key length BKDR XXH3-64
32 bytes 152 ns/op 112 ns/op
64 bytes 192 ns/op 116 ns/op
128 bytes 307 ns/op 129 ns/op

With eight concurrent readers, 64-byte keys delivered approximately 26% higher throughput in this benchmark. Results depend on key length, CPU, and workload; short keys may see little or no improvement.

Upgrade

go get github.com/orca-zhang/ecache@v1.2.0

Full changelog: v1.1.3...v1.2.0