oxc/crates/oxc_parser
Don Isaac 27030b9eb4
perf(lexer): use bitshifting when parsing known integers (#3296)
## What This PR Does

- perf(lexer): use bit shifting when parsing hex, octal, and binary
integers instead of `mul_add`-ing on `f64`s. Check out the difference in
assembly generated [here](https://godbolt.org/z/zMEKaeYzh)
- perf(lexer): skip redundant utf8 check when parsing BigInts
- refactor(lexer): remove `unsafe` usage (as per @overlookmotel's
request
[here](https://github.com/oxc-project/oxc/pull/3283#issuecomment-2111814598))
- test(lexer): add numeric parsing unit tests

I don't expect this PR to have a large performance improvement, since
the most common case (`Kind::Decimal`) is not affected. We could do
this, however, by splitting `Kind::Decimal` into `Kind::DecimalFloat`
and `Kind::DecimalInt` when the lexer encounters a `.`
2024-05-17 09:39:10 +08:00
..
examples Make ast types covariant over the allocator lifetime. (#2943) 2024-04-12 18:12:18 +08:00
src perf(lexer): use bitshifting when parsing known integers (#3296) 2024-05-17 09:39:10 +08:00
Cargo.toml perf(lexer): use bitshifting when parsing known integers (#3296) 2024-05-17 09:39:10 +08:00
CHANGELOG.md Release crates v0.13.0 2024-05-14 23:14:15 +08:00