mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-12 09:56:45 +02:00
The std default RandomState (SipHash) was using ~9 percentage points of CPU on hash_one and write across the parse hot path, with the string interner adding another ~3 pp on top. The cost was spread across the interner, the scope collector's IndexMap<Utf16String, _>, and several parser-side HashSet<Utf16String> declarations. Use foldhash::quality::RandomState for the parser, scope collector, and string interner via a new fast_hash module. Quality keeps HashDoS resistance (keys are lexer tokens, attacker-controlled in a browser context) while shedding SipHash's per-byte cost, and on this workload it benchmarks slightly faster than foldhash::fast.