Skip to content

perf(transformer/typescript): reduce scope_id() calls#18097

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/01-16-perf_transformer_typescript_reduce_scope_id_calls
Jan 16, 2026
Merged

perf(transformer/typescript): reduce scope_id() calls#18097
graphite-app[bot] merged 1 commit intomainfrom
om/01-16-perf_transformer_typescript_reduce_scope_id_calls

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 16, 2026

Tiny optimization. Calling EnumBody::scope_id has a cost (a panicking branch). We already called it earlier in this function and have the scope ID in a local var. Use that value, rather then calling scope_id() again.

@github-actions github-actions bot added the A-transformer Area - Transformer / Transpiler label Jan 16, 2026
Copy link
Member Author

overlookmotel commented Jan 16, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Jan 16, 2026
@overlookmotel overlookmotel marked this pull request as ready for review January 16, 2026 16:44
Copilot AI review requested due to automatic review settings January 16, 2026 16:44
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 16, 2026

Merging this PR will not alter performance

✅ 38 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing om/01-16-perf_transformer_typescript_reduce_scope_id_calls (d1fa554) with main (08dad63)2

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on om/01-16-refactor_semantic_remove_unnecessary_code (8e94bb7) during the generation of this report, so main (08dad63) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a micro-optimization in the TypeScript enum transformation code by eliminating a redundant method call. The scope_id() method has a cost (including a panicking branch), and since the scope ID was already retrieved and stored in a local variable earlier in the function, the code now reuses that cached value instead of making the same call again.

Changes:

  • Replace redundant decl.body.scope_id() call with the existing func_scope_id variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overlookmotel overlookmotel self-assigned this Jan 16, 2026
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jan 16, 2026
Copy link
Member Author

overlookmotel commented Jan 16, 2026

Merge activity

Tiny optimization. Calling `EnumBody::scope_id` has a cost (a panicking branch). We already called it earlier in this function and have the scope ID in a local var. Use that value, rather then calling `scope_id()` again.
@graphite-app graphite-app bot force-pushed the om/01-16-refactor_semantic_remove_unnecessary_code branch from 8e94bb7 to 4a312a0 Compare January 16, 2026 16:53
@graphite-app graphite-app bot force-pushed the om/01-16-perf_transformer_typescript_reduce_scope_id_calls branch from d1fa554 to 837edf6 Compare January 16, 2026 16:54
Base automatically changed from om/01-16-refactor_semantic_remove_unnecessary_code to main January 16, 2026 17:00
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 16, 2026
@graphite-app graphite-app bot merged commit 837edf6 into main Jan 16, 2026
22 checks passed
@graphite-app graphite-app bot deleted the om/01-16-perf_transformer_typescript_reduce_scope_id_calls branch January 16, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants