oxc/crates/oxc_parser
Boshen 4706765d2a
refactor(parser): reduce Token size from 32 to 16 bytes (#1962)
Part of #1880

`Token` size is reduced from 32 to 16 bytes by changing the previous
token value `Option<&'a str>` to a u32 index handle.

It would be nice if this handle is eliminated entirely because
the normal case for a string is always
`&source_text[token.span.start.token.span.end]`

Unfortunately, JavaScript allows escaped characters to appear in
identifiers, strings and templates. These strings need to be unescaped
for equality checks, i.e. `"\a"  === "a"`.

This leads us to adding a `escaped_strings[]` vec for storing these
unescaped and allocated
strings.

Performance regression for adding this vec should be minimal because
escaped strings are rare.

Background Reading:

* https://floooh.github.io/2018/06/17/handles-vs-pointers.html
2024-01-09 15:17:02 +08:00
..
examples chore(clippy): enable undocumented_unsafe_blocks 2023-10-16 15:18:14 +08:00
src refactor(parser): reduce Token size from 32 to 16 bytes (#1962) 2024-01-09 15:17:02 +08:00
Cargo.toml chore(deps): bump the dependencies group with 11 updates (#1865) 2024-01-01 08:06:33 +00:00