This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
╔════════════════════════════════════════════════════════════════╗ | |
║ Results ║ | |
╚════════════════════════════════════════════════════════════════╝ | |
┌─ Very Short (2-4 bytes) ────────────────────────────────────┐ | |
│ Implementation │ Ops/sec │ ns/cmp │ vs baseline │ | |
├───────────────────────────┼────────────┼────────┼─────────────┤ | |
│ 🏆 SIMD Opt1 (comptime) │ 893694982 │ 1.12 │ 1.00x │ | |
│ SIMD Opt4 (xor) │ 862645302 │ 1.16 │ 0.97x │ | |
│ SIMD Opt2 (unrolled) │ 861406870 │ 1.16 │ 0.96x │ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
// Import all hash functions we want to test | |
const Wyhash = std.hash.Wyhash; | |
const CityHash64 = std.hash.CityHash64; | |
const Murmur3_32 = std.hash.Murmur3_32; | |
/// FNV-1a implementation | |
fn fnv1aHash(s: []const u8) u32 { | |
if (s.len == 0) return 0; |