next.js
bd7287f9 - Turbopack: use simd-utf16-len for source position column counting (#100973)

Commit
19 days ago
Turbopack: use simd-utf16-len for source position column counting (#100973) ## Summary Follow-up to #100919. `SourcePos::update` now counts the UTF-16 length of the final line segment with the SIMD kernels of [`simd-utf16-len`](https://github.com/SyMind/simd-utf16-len), so that counting is fast even on long lines such as minified code. It uses `utf16_len_bytes`, the safe byte-slice API added in `simd-utf16-len` 0.4.0 (https://github.com/SyMind/simd-utf16-len/pull/22). `SourcePos::update` passes rope bytes directly, with no `unsafe` conversion to `&str`. The result is exact for valid UTF-8. For other bytes the call is still safe, but the count is unspecified. Line-terminator handling and the complete-text chunk contract from #100919 are unchanged. The `SourcePos` tests continue to cover column semantics. ## Verification - `cargo test -p turbopack-core --lib` - `cargo fmt -p turbopack-core --check` - `cargo clippy -p turbopack-core --tests` <!-- NEXT_JS_LLM --> <!-- fleet 8a1a11e5-9ce4-4f06-b7cb-50485f329e62 --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
Author
Parents
Loading