refactor(oxc_str): add IncrementalIdentHasher for byte-by-byte hash computation#18451
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
d4ca5d4 to
046b4e6
Compare
1a13ac9 to
a25cdb3
Compare
046b4e6 to
cceaf1e
Compare
1c918ed to
6d1cc47
Compare
6d1cc47 to
fc67309
Compare
cceaf1e to
f04def0
Compare
…omputation Replace the complex const FxHash implementation with a simpler incremental hasher that can compute hashes byte-by-byte during lexing. - Add `IncrementalIdentHasher` struct with `write_byte()`, `write_bytes()`, and `finish()` methods - Add `Ident::new_with_hash()` for creating Idents with precomputed hash - Simplify `compute_hash()` const function to use the same incremental algorithm - Update `Ident::new()` to use the incremental hasher Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The IncrementalIdentHasher was using `usize` which is 32-bit on wasm32, causing overflow errors: - The constant K doesn't fit in 32 bits - The `>> 32` shift would overflow on 32-bit Changed to use explicit `u64` for consistent behavior across platforms. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fc67309 to
ece98da
Compare
f04def0 to
26aca72
Compare

Replace the complex const FxHash implementation with a simpler incremental
hasher that can compute hashes byte-by-byte during lexing.
IncrementalIdentHasherstruct withwrite_byte(),write_bytes(), andfinish()methodsIdent::new_with_hash()for creating Idents with precomputed hashcompute_hash()const function to use the same incremental algorithmIdent::new()to use the incremental hasherCo-Authored-By: Claude Opus 4.5 noreply@anthropic.com