Skip to content

Comments

refactor(transformer/react-refresh): dereference ScopeId as soon as possible#6820

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

refactor(transformer/react-refresh): dereference ScopeId as soon as possible#6820
graphite-app[bot] merged 1 commit intomainfrom
10-23-refactor_transformer_react-refresh_dereference_scopeid_as_soon_as_possible

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Oct 23, 2024

Style nit. Dereference &ScopeId to ScopeId as early as possible. &ScopeId is 8 bytes, whereas ScopeId is 4 bytes.

In simple cases like this, 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 the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Oct 23, 2024
@overlookmotel overlookmotel marked this pull request as ready for review October 23, 2024 12:51
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 23, 2024

CodSpeed Performance Report

Merging #6820 will not alter performance

Comparing 10-23-refactor_transformer_react-refresh_dereference_scopeid_as_soon_as_possible (21ec0e0) with 10-23-refactor_transformer_react-refresh_unwrap_bindingidentifier_symbol_id_ (f7c7a23)

Summary

✅ 30 untouched benchmarks

@overlookmotel overlookmotel force-pushed the 10-23-refactor_transformer_react-refresh_unwrap_bindingidentifier_symbol_id_ branch from f276ed6 to f7c7a23 Compare October 23, 2024 13:02
@overlookmotel overlookmotel force-pushed the 10-23-refactor_transformer_react-refresh_dereference_scopeid_as_soon_as_possible branch from 05d41fe to 21ec0e0 Compare October 23, 2024 13:02
@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Oct 23, 2024
Copy link
Member

Dunqing commented Oct 23, 2024

Merge activity

  • Oct 23, 9:14 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, 9:14 AM EDT: A user added this pull request to the Graphite merge queue.
  • Oct 23, 9:53 AM EDT: A user merged this pull request with the Graphite merge queue.

… possible (#6820)

Style nit. Dereference `&ScopeId` to `ScopeId` as early as possible. `&ScopeId` is 8 bytes, whereas `ScopeId` is 4 bytes.

In simple cases like this, 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`.
@Dunqing Dunqing force-pushed the 10-23-refactor_transformer_react-refresh_unwrap_bindingidentifier_symbol_id_ branch from f7c7a23 to 57685b2 Compare October 23, 2024 13:28
@Dunqing Dunqing force-pushed the 10-23-refactor_transformer_react-refresh_dereference_scopeid_as_soon_as_possible branch from 21ec0e0 to e5f4b4a Compare October 23, 2024 13:28
@Boshen Boshen requested a review from Dunqing October 23, 2024 13:31
Base automatically changed from 10-23-refactor_transformer_react-refresh_unwrap_bindingidentifier_symbol_id_ to main October 23, 2024 13:50
@graphite-app graphite-app bot merged commit e5f4b4a into main Oct 23, 2024
@graphite-app graphite-app bot deleted the 10-23-refactor_transformer_react-refresh_dereference_scopeid_as_soon_as_possible branch October 23, 2024 13:53
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-transformer Area - Transformer / Transpiler 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.

2 participants