How fast can we recognize a word from a small pre-determined set?
by BurntSushiRust
Last 12 weeks · 0 commits
2 of 6 standards met
This commit contains an experiment in using AVX-512 SIMD intrinsics to do the lookup. Because AVX-512 is not stable, it must be run with nightly. In addition, it must be run with target-cpu=native on a CPU with AVX-512. The central technique is a perfect hash, but not minimal. The hash generates unique values for each of the keys, in a 128-entry lookup table. An important technique is the masked load, to ensure no values past the end of the slice are loaded. In spite of all this, it's 1.15 - 1.5x slower than the big prefix match on my Zen 5 (AMD HX 370) machine. Because the code is basically branchless, it may perform better on less predictable workloads.
Repository: BurntSushi/duration-unit-lookup. Description: How fast can we recognize a word from a small pre-determined set? Stars: 87, Forks: 4. Primary language: Rust. Languages: Rust (91.5%), C (8.5%). License: Unlicense. Open PRs: 1, open issues: 0. Last activity: 1y ago. Community health: 42%. Top contributors: BurntSushi.