Skip to content

Comments

refactor(linter): dereference IDs as soon as possible#6821

Merged
graphite-app[bot] merged 1 commit intomainfrom
10-23-refactor_linter_dereference_ids_as_soon_as_possible
Oct 23, 2024
Merged

refactor(linter): dereference IDs as soon as possible#6821
graphite-app[bot] merged 1 commit intomainfrom
10-23-refactor_linter_dereference_ids_as_soon_as_possible

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Oct 23, 2024

Style nit. Dereference &ScopeId to ScopeId (and other IDs) as early as possible. &ScopeId is 8 bytes, whereas ScopeId is 4 bytes.

In simple cases like these, compiler will optimize it anyway, but still I think it's a better pattern to dererence early. In more complicated cases, it will be better for performance, and in my opinion, it makes things clearer if vars called scope_id are always a ScopeId, not sometimes a &ScopeId.

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 23, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-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.

@github-actions github-actions bot added A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Oct 23, 2024
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @overlookmotel and the rest of your teammates on Graphite Graphite

@overlookmotel overlookmotel marked this pull request as ready for review October 23, 2024 12:54
@overlookmotel
Copy link
Member Author

Small style nit, so merging without review.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Oct 23, 2024
Copy link
Member Author

overlookmotel commented Oct 23, 2024

Merge activity

  • Oct 23, 8:56 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 23, 8:58 AM EDT: A user added this pull request to the Graphite merge queue.
  • Oct 23, 9:02 AM EDT: A user merged this pull request with the Graphite merge queue.

Style nit. Dereference `&ScopeId` to `ScopeId` (and other IDs) as early as possible. `&ScopeId` is 8 bytes, whereas `ScopeId` is 4 bytes.

In simple cases like these, compiler will optimize it anyway, but still I think it's a better pattern to dererence early. In more complicated cases, it will be better for performance, and in my opinion, it makes things clearer if vars called `scope_id` are always a `ScopeId`, not sometimes a `&ScopeId`.
@overlookmotel overlookmotel force-pushed the 10-23-refactor_linter_dereference_ids_as_soon_as_possible branch from c612051 to a148023 Compare October 23, 2024 12:57
@graphite-app graphite-app bot merged commit a148023 into main Oct 23, 2024
@graphite-app graphite-app bot deleted the 10-23-refactor_linter_dereference_ids_as_soon_as_possible branch October 23, 2024 13:02
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 23, 2024

CodSpeed Performance Report

Merging #6821 will not alter performance

Comparing 10-23-refactor_linter_dereference_ids_as_soon_as_possible (a148023) with main (1107770)

Summary

✅ 30 untouched benchmarks

Boshen added a commit that referenced this pull request Oct 26, 2024
## [0.10.3] - 2024-10-26

- 90c786c regular_expression: [**BREAKING**] Support ES2025 Duplicated
named capture groups (#6847) (leaysgur)

- 8032813 regular_expression: [**BREAKING**] Migrate to new regexp
parser API (#6741) (leaysgur)

### Features

- a73c5af linter: Add fixer for `jsx-a11y/no-access-key` rule (#6781)
(Tapan Prakash)
- 2aa763c linter: Warn unmatched rule names (#6782) (Tapan Prakash)
- 0acca58 linter: Support `--print-config all` to print config file for
project (#6579) (mysteryven)

### Bug Fixes

- f49b3e2 linter: `react/iframe-missing-sandbox` ignores vanilla JS APIs
(#6872) (DonIsaac)
- 54a5032 linter: Correct false positive in `no-duplicates` (#6748)
(dalaoshu)
- a47c70e minifier: Fix remaining runtime bugs (#6855) (Boshen)

### Documentation

- 3923e63 linter: Add schema to config examples (#6838) (Dmitry
Zakharov)

### Refactor

- a148023 linter: Dereference IDs as soon as possible (#6821)
(overlookmotel)
- 423d54c rust: Remove the annoying `clippy::wildcard_imports` (#6860)
(Boshen)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Orenbek pushed a commit to Orenbek/oxc that referenced this pull request Oct 28, 2024
## [0.10.3] - 2024-10-26

- 90c786c regular_expression: [**BREAKING**] Support ES2025 Duplicated
named capture groups (oxc-project#6847) (leaysgur)

- 8032813 regular_expression: [**BREAKING**] Migrate to new regexp
parser API (oxc-project#6741) (leaysgur)

### Features

- a73c5af linter: Add fixer for `jsx-a11y/no-access-key` rule (oxc-project#6781)
(Tapan Prakash)
- 2aa763c linter: Warn unmatched rule names (oxc-project#6782) (Tapan Prakash)
- 0acca58 linter: Support `--print-config all` to print config file for
project (oxc-project#6579) (mysteryven)

### Bug Fixes

- f49b3e2 linter: `react/iframe-missing-sandbox` ignores vanilla JS APIs
(oxc-project#6872) (DonIsaac)
- 54a5032 linter: Correct false positive in `no-duplicates` (oxc-project#6748)
(dalaoshu)
- a47c70e minifier: Fix remaining runtime bugs (oxc-project#6855) (Boshen)

### Documentation

- 3923e63 linter: Add schema to config examples (oxc-project#6838) (Dmitry
Zakharov)

### Refactor

- a148023 linter: Dereference IDs as soon as possible (oxc-project#6821)
(overlookmotel)
- 423d54c rust: Remove the annoying `clippy::wildcard_imports` (oxc-project#6860)
(Boshen)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant