mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
Number-key reads of a map without the direct index called scr_map_entry_f64 for every lookup. The internal sc_map_entry_f64 helper now calls sc_map_entry_f64_hashed for such maps instead: it hashes the key as scr_map_find_f64 does (SameValueZero key word, scr_key_mix, the absent-key filter), scans the entries of a small map or probes a compact bucket table, and calls the runtime lookup only for a table wider than the compact limit. It stays out of line so the direct-index path stays small at every call site. The runtime fallback is called as a read-only call, so both helpers only read memory and LLVM merges lookups of one key when nothing is stored in between, such as a has() followed by get(). The runtime benchmark suite gains number-maps: a node table indexed by dense ids, scope tables keyed by sparse ids, and get/has/set mixes.