oxc/crates
overlookmotel 4996874dda perf(traverse): generate_uid cache available binding names (#5611)
Close #5488.

`generate_uid` previously iterated through every symbol and unresolved reference in the AST to find a unique var name. If the first var name it tried was already in use, it'd iterate again.

Instead build a hash map recording existing var names in use for every name which could clash with a UID (any var name starting with `_`). Once built, use that hash map to generate UIDs without iterating through all symbols again.

I had hoped to make `generate_uid` cheaper still by just recording the highest digits postfix for each var name, and then incrementing that postfix for each UID. i.e. if AST contains vars `_foo1` and `_foo6`, create UIDs starting at one number higher - `_foo7`, `_foo8` etc. This method would be more efficient, but unfortunately it does not match Babel, and so causes some of Babel's tests to fail.
2024-09-10 01:12:19 +00:00
..
oxc chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_allocator chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_ast chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_ast_macros chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_cfg chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_codegen feat(span)!: change SourceType::js to SourceType::cjs and SourceType::mjs (#5606) 2024-09-08 14:11:02 +00:00
oxc_diagnostics chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_index refactor(index, traverse): remove unnecessary type annotations (#5650) 2024-09-09 14:07:56 +00:00
oxc_isolated_declarations feat(span)!: change SourceType::js to SourceType::cjs and SourceType::mjs (#5606) 2024-09-08 14:11:02 +00:00
oxc_language_server chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_linter refactor(linter): use std::ptr::eq (#5649) 2024-09-09 15:28:10 +00:00
oxc_macros chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_mangler chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_minifier feat(span)!: change SourceType::js to SourceType::cjs and SourceType::mjs (#5606) 2024-09-08 14:11:02 +00:00
oxc_module_lexer feat(span)!: change SourceType::js to SourceType::cjs and SourceType::mjs (#5606) 2024-09-08 14:11:02 +00:00
oxc_parser feat(span)!: change SourceType::js to SourceType::cjs and SourceType::mjs (#5606) 2024-09-08 14:11:02 +00:00
oxc_prettier chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_regular_expression fix(regular_expression): Improve RegExp to_string() results (#5635) 2024-09-09 08:17:55 +00:00
oxc_semantic refactor(semantic): SymbolTable::is_empty use is_empty (#5622) 2024-09-09 01:07:34 +00:00
oxc_sourcemap chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_span fix(span): treat .js as module file (reverts the previous breaking change) (#5612) 2024-09-08 15:14:04 +00:00
oxc_syntax chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_transformer chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
oxc_traverse perf(traverse): generate_uid cache available binding names (#5611) 2024-09-10 01:12:19 +00:00
oxc_wasm chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00