Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(syntax): give ScopeId a niche #4468

Merged
merged 1 commit into from
Jul 26, 2024

Commits on Jul 26, 2024

  1. refactor(syntax): give ScopeId a niche (#4468)

    Make `ScopeId` a type with a niche, like `SymbolId` and `ReferenceId`. This makes `Option<ScopeId>` 4 bytes instead of 8, and shrinks various AST types e.g. `ArrowFunctionExpression` by 8 bytes, and halves the size of the `Vec` in `ScopeTree::parent_ids`.
    
    The snapshot change on `prefer-hooks-in-order` lint rule appears incidental - it doesn't alter what errors are reported, only the order they're reported in. This appears to be because it changes the order of keys in a hashmap keyed by `ScopeId` that [the rule uses](https://github.com/oxc-project/oxc/blob/a49f4915de38a57f9da4488b4d38b592ee15619f/crates/oxc_linter/src/rules/jest/prefer_hooks_in_order.rs#L143).
    overlookmotel committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    c99b3eb View commit details
    Browse the repository at this point in the history