mirror of
https://github.com/hanzoai/swc.git
synced 2026-10-30 19:42:53 +00:00
## Summary - optimize numeric-separator stripping in `swc_ecma_parser` lexer hot path by replacing `chars()` filtering with byte-level filtering - keep fast path behavior (`Cow::Borrowed`) when no underscore is present - add a focused lexer benchmark case for underscore-heavy numeric literals - add parser regression fixture coverage for issue `#11649` ## Changes - `crates/swc_ecma_parser/src/lexer/mod.rs` - rewrote `remove_underscore` to process bytes and build the stripped string without UTF-8 char iteration - `crates/swc_ecma_parser/benches/files/numeric-separators.js` - added a numeric-separator-heavy benchmark corpus - `crates/swc_ecma_parser/benches/lexer.rs` - added `es/lexer/numeric-separators` benchmark entry - `crates/swc_ecma_parser/tests/js/issue-11649/input.js` - `crates/swc_ecma_parser/tests/js/issue-11649/input.js.json` ## Verification - `git submodule update --init --recursive` - `UPDATE=1 cargo test -p swc_ecma_parser --test js issue_11649 -- --ignored` - `cargo test -p swc_ecma_parser --test js issue_11649 -- --ignored` - `cargo test -p swc_ecma_parser --test js issue_10724 -- --ignored` - `cargo test -p swc_ecma_parser` - `cargo bench -p swc_ecma_parser --bench lexer -- numeric-separators` - `cargo fmt --all` - `cargo clippy --all --all-targets -- -D warnings` Fixes #11649