-
-
Notifications
You must be signed in to change notification settings - Fork 466
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your org has enabled the Graphite merge queue for merging into mainAdd the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This was referenced Jul 25, 2024
CodSpeed Performance ReportMerging #4468 will not alter performanceComparing Summary
|
overlookmotel
force-pushed
the
07-25-refactor_syntax_give_scopeid_a_niche
branch
from
July 25, 2024 19:33
bb3b1aa
to
b62822d
Compare
This was referenced Jul 25, 2024
Merge activity
|
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).
Boshen
force-pushed
the
07-25-refactor_syntax_use_nonmaxu32_for_ids
branch
from
July 26, 2024 00:19
046db29
to
96fc94f
Compare
Boshen
force-pushed
the
07-25-refactor_syntax_give_scopeid_a_niche
branch
from
July 26, 2024 00:19
b62822d
to
c99b3eb
Compare
Boshen
changed the base branch from
07-25-refactor_syntax_use_nonmaxu32_for_ids
to
main
July 26, 2024 00:33
Merged
Dunqing
pushed a commit
that referenced
this pull request
Jul 28, 2024
## [0.22.1] - 2024-07-27 ### Features - 2477330 ast: Add `AstKind::TSExportAssignment` (#4501) (Dunqing) - aaee07e ast: Add `AstKind::AssignmentTargetPattern`, `AstKind::ArrayAssignmentTarget` and `AstKind::ObjectAssignmentTarget` (#4456) (Dunqing) - fd363d1 ast: Add AstKind::get_container_scope_id (#4450) (DonIsaac) - e2735ca span: Add `contains_inclusive` method (#4491) (DonIsaac) ### Bug Fixes - 368112c ast: Remove `#[visit(ignore)]` from `ExportDefaultDeclarationKind`'s `TSInterfaceDeclaration` (#4497) (Dunqing) - 36bb680 semantic: `TSExportAssignment` cannot reference type binding (#4502) (Dunqing) - cb2fa49 semantic: `typeof` operator cannot reference type-only import (#4500) (Dunqing) - ef0e953 semantic: Generic passed to typeof not counted as a reference (#4499) (Dunqing) - 40cafb8 semantic: Params in `export default (function() {})` flagged as `SymbolFlags::Export` (#4480) (Dunqing) - 2e01a45 semantic: Non-exported namespace member symbols flagged as exported (#4493) (Don Isaac) - e4ca06a semantic: Incorrect symbol’s scope_id after var hoisting (#4458) (Dunqing) - 77bd5f1 semantic: Use correct span for namespace symbols (#4448) (Don Isaac) - 5db7bed sourcemap: Fix pre-calculation of required segments for building JSON (#4490) (overlookmotel) - 1667491 syntax: Correct `is_reserved_keyword_or_global_object`'s incorrect function calling. (#4484) (Ethan Goh) - 82ba2a0 syntax: Fix unsound use of `NonZeroU32` (#4466) (overlookmotel) - c04b9aa transformer: Add to `SymbolTable::declarations` for all symbols (#4460) (overlookmotel) - ecdee88 transformer/typescript: Incorrect eliminate exports when the referenced symbol is both value and type (#4507) (Dunqing) ### Performance - 963a2d1 mangler: Reduce unnecessary allocation (#4498) (Dunqing) - 868fc87 parser: Optimize conditional advance on ASCII values (#4298) (lucab) - 24beaeb semantic: Give `AstNodeId` a niche (#4469) (overlookmotel) - 348c1ad semantic: Remove `span` field from `Reference` (#4464) (overlookmotel) - 6a9f4db semantic: Reduce storage size for symbol redeclarations (#4463) (overlookmotel) - 705e19f sourcemap: Reduce memory copies encoding JSON (#4489) (overlookmotel) - 4d10c6c sourcemap: Pre allocate String buf while encoding (#4476) (Brooooooklyn) ### Documentation - f5f0ba8 ast: Add doc comments to more AST nodes (#4413) (Don Isaac) - 871b3d6 semantic: Add doc comments for SymbolTester and SemanticTester (#4433) (DonIsaac) ### Refactor - 9c5d2f9 ast/builder: Use `Box::new_in` over `.into_in` (#4428) (overlookmotel) - ccb1835 semantic: Methods take `Span` as param, not `&Span` (#4470) (overlookmotel) - f17254a semantic: Populate `declarations` field in `SymbolTable::create_symbol` (#4461) (overlookmotel) - a49f491 semantic: Re-order `SymbolTable` fields (#4459) (overlookmotel) - 7cd53f3 semantic: Var hoisting (#4379) (Dunqing) - 4f5a7cb semantic: Mark SemanticTester and SymbolTester as must_use (#4430) (DonIsaac) - c958a55 sourcemap: `push_list` method for building JSON (#4486) (overlookmotel) - c99b3eb syntax: Give `ScopeId` a niche (#4468) (overlookmotel) - 96fc94f syntax: Use `NonMaxU32` for IDs (#4467) (overlookmotel) ### Testing - 4b274a8 semantic: Add more test cases for symbol references (#4429) (DonIsaac) Co-authored-by: Boshen <[email protected]>
Merged
Boshen
added a commit
that referenced
this pull request
Aug 5, 2024
## [0.7.0] - 2024-08-05 - 85a7cea semantic: [**BREAKING**] Remove name from `reference` (#4329) (Dunqing) ### Features - aaee07e ast: Add `AstKind::AssignmentTargetPattern`, `AstKind::ArrayAssignmentTarget` and `AstKind::ObjectAssignmentTarget` (#4456) (Dunqing) - 9df7b56 jsx-a11y/no-autofocus: Implement fixer support (#4171) (Jelle van der Waa) - b87bf70 linter: Add fix capabilties to existing lint rules (#4560) (DonIsaac) - ddd8b27 linter: Support conditional fix capabilities (#4559) (DonIsaac) - b952942 linter: Add eslint/no-unused-vars (⭐ attempt 3.2) (#4445) (DonIsaac) - 6543958 linter: Add auto-fix metadata to RuleMeta (#4557) (Don Isaac) - 85e8418 linter: Add react/jsx-curly-brace-presence (#3949) (Don Isaac) - 4c4da56 linter: Add typescript-eslint/prefer-keyword-namespce (#4438) (Aza Walker) - d8c2a83 linter: Eslint-plugin-vitest/no-import-node-test (#4440) (cinchen) - e3b0c40 linter: Eslint-plugin-vitest/no-identical-title (#4422) (cinchen) - c936782 linter: Eslint-plugin-vitest/no-conditional-expect (#4425) (cinchen) - 27fdd69 linter: Eslint-plugin-vitest/no-commented-out-tests (#4424) (cinchen) - 51f5025 linter: Add fixer for unicorn/prefer-string-starts-ends-with (#4378) (DonIsaac) - 3c0c709 linter: Add typescript-eslint/no-extraneous-class (#4357) (Jaden Rodriguez) - 7afa1f0 linter: Support suggestions and dangerous fixes (#4223) (DonIsaac) - acc5729 linter: Eslint-plugin-vitest/expect-expect (#4299) (cinchen) - 2213f93 linter: Eslint-plugin-vitest/no-alias-methods (#4301) (cinchen) - c296bc3 linter/eslint: Implement func-names (#4618) (Alexander S.) - e116ae0 linter/eslint: Implement fixer for prefer-numeric-literals (#4591) (Jelle van der Waa) - eaf834f linter/eslint: Implement prefer-numeric-literals (#4109) (Jelle van der Waa) - db2fd70 linter/eslint-plugin-promise: Implement no-webpack-loader-syntax (#4331) (Jelle van der Waa) - 5f1e070 linter/eslint-plugin-unicorn: Add fixer for prefer-code-point (#4353) (Jelle van der Waa) - ed49e16 linter/eslint-plugin-unicorn: Implement fixer for prefer-dom-node-append (#4306) (Jelle van der Waa) - e2b15ac linter/react: Implement react-jsx-boolean-value (#4613) (Jelle van der Waa) - 68efcd4 linter/react-perf: Handle new objects and arrays in prop assignment patterns (#4396) (DonIsaac) ### Bug Fixes - 368112c ast: Remove `#[visit(ignore)]` from `ExportDefaultDeclarationKind`'s `TSInterfaceDeclaration` (#4497) (Dunqing) - d384f60 ci: Remove unused(?) .html file (#4545) (Yuji Sugiura) - 06aec77 linter: Invalid binary expression with overflow (#4647) (DonIsaac) - b2da22b linter: Invalid tags in rule docs (#4646) (DonIsaac) - 94440ad linter: Panic on invalid lang in `a11y/lang`. (#4630) (rzvxa) - e0b03f8 linter: Improve the boundary for eslint/for-direction (#4590) (heygsc) - 70b8cfa linter: Missing return in no-obj-calls recursion (#4594) (DonIsaac) - fe1356d linter: Change no-unused-vars to nursery (#4588) (DonIsaac) - 72337b1 linter: Change typescript-eslint/no-namespace to restriction (#4539) (Don Isaac) - 732f4e2 linter: Fix `oxlint` allocator cfg (#4527) (overlookmotel) - 289dc39 linter: Overflow in no-obj-calls (#4397) (DonIsaac) - a664715 linter/eslint: Fix invalid regexp in no_regex_spaces test (#4605) (Yuji Sugiura) - 74fa75a linter/eslint: Drop quotes around max-params lint warning (#4608) (Jelle van der Waa) - 9fcd9ae linter/eslint: Fix invalid regexp in no_control_regex test (#4544) (leaysgur) - ac08de8 linter/react_perf: Allow new objects, array, fns, etc in top scope (#4395) (DonIsaac) - 0fba738 npm: SyntaxError caused by optional chaining in low version node (#4650) (heygsc) - 73d2558 oxlint: Fix oxlint failed to build due to missing feature (Boshen) ### Performance - 6ff200d linter: Change react rules and utils to use `Cow` and `CompactStr` instead of `String` (#4603) (DonIsaac) - f259df0 linter: Make img-redundant-alt only build a regex once (#4604) (DonIsaac) - 7585e16 linter: Remove allocations for string comparisons (#4570) (DonIsaac) - b60bdf1 linter: `no_shadow_restricted_names` only look up name in hashmap once (#4472) (overlookmotel) - 81384f5 linter: Avoid unnecessary work in `nextjs:no_duplicate_head` rule (#4465) (overlookmotel) - f7da22d linter: Disable lint rules by file type (#4380) (DonIsaac) - 348c1ad semantic: Remove `span` field from `Reference` (#4464) (overlookmotel) - 6a9f4db semantic: Reduce storage size for symbol redeclarations (#4463) (overlookmotel)- a207923 Replace some CompactStr usages with Cows (#4377) (DonIsaac) ### Refactor - 7a75e0f linter: Use diagnostic codes in lint rules (#4349) (DonIsaac) - ccb1835 semantic: Methods take `Span` as param, not `&Span` (#4470) (overlookmotel) - 7cd53f3 semantic: Var hoisting (#4379) (Dunqing) - c99b3eb syntax: Give `ScopeId` a niche (#4468) (overlookmotel) Co-authored-by: Boshen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make
ScopeId
a type with a niche, likeSymbolId
andReferenceId
. This makesOption<ScopeId>
4 bytes instead of 8, and shrinks various AST types e.g.ArrowFunctionExpression
by 8 bytes, and halves the size of theVec
inScopeTree::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 byScopeId
that the rule uses.