oxc/crates/oxc_mangler
overlookmotel d17021c834 perf(mangler): optimize base54 function (#8557)
Optimize mangler by creating identifiers in an inline array, instead of using the more expensive `CompactString`, and optimize `base54` function.

There's an unfortunate workaround necessary because of debug mode. In "normal" mode, identifiers are maximum 11 bytes (`usize::MAX` -> `ZrN6rN6rN6r`) but in debug mode they can be up to 25 bytes (`usize::MAX` -> `slot_18446744073709551615`). So this PR splits `build_with_symbols_and_scopes` into 2 branches for "normal" and "debug" modes with a generic function parameterized by max length of the string.

This is not ideal - it will increase binary size a bit, but everything else I tried (e.g. allocating strings into arena) was much slower.

The main motivation for this change wasn't actually performance. While working on allocator, I discovered that `CompactString`s were being allocated in arena (`reserved_names: ArenaVec<CompactStr>`), and wanted to remove them.
2025-01-17 05:47:28 +00:00
..
src perf(mangler): optimize base54 function (#8557) 2025-01-17 05:47:28 +00:00
Cargo.toml perf(mangler): optimize base54 function (#8557) 2025-01-17 05:47:28 +00:00
CHANGELOG.md release(crates): v0.46.0 (#8487) 2025-01-14 19:40:44 +08:00