Skip to content

perf(ast): re-order VariableDeclarationKind variants#9853

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-18-perf_ast_re-order_variabledeclarationkind_variants
Mar 18, 2025
Merged

perf(ast): re-order VariableDeclarationKind variants#9853
graphite-app[bot] merged 1 commit intomainfrom
03-18-perf_ast_re-order_variabledeclarationkind_variants

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 18, 2025

Micro-optimization.

Re-order variants of VariableDeclarationKind. With this order:

  • Checking if it's a lexical declaration is discriminant != 0
  • Checking if it's const is discriminant > 1.

The latter is a couple of instructions shorter than it was before (discriminant == 1 || discriminant > 2).

Copy link
Member Author


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 A-ast Area - AST C-performance Category - Solution not expected to change functional behavior, only performance labels Mar 18, 2025
@overlookmotel overlookmotel marked this pull request as ready for review March 18, 2025 07:04
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 18, 2025

CodSpeed Performance Report

Merging #9853 will not alter performance

Comparing 03-18-perf_ast_re-order_variabledeclarationkind_variants (2d63704) with main (73fe248)

Summary

✅ 33 untouched benchmarks

@overlookmotel
Copy link
Member Author

@camc314 In case you're interested, this relates to your question #9751 (comment). But this is a micro micro optimization. Only saves a couple of instructions, which is a drop in ocean.

@camc314
Copy link
Contributor

camc314 commented Mar 18, 2025

all the drops add up 🙂

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 18, 2025
Copy link
Contributor

camc314 commented Mar 18, 2025

Merge activity

  • Mar 18, 3:33 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 18, 3:33 AM EDT: A user added this pull request to the Graphite merge queue.
  • Mar 18, 3:46 AM EDT: A user merged this pull request with the Graphite merge queue.

Micro-optimization.

Re-order variants of `VariableDeclarationKind`. With this order:

* Checking if it's a lexical declaration is `discriminant != 0`
* Checking if it's const is `discriminant > 1`.

The latter is a couple of instructions shorter than it was before (`discriminant == 1 || discriminant > 2`).
@graphite-app graphite-app bot force-pushed the 03-18-perf_ast_re-order_variabledeclarationkind_variants branch from 4f08f42 to 2d63704 Compare March 18, 2025 07:37
@graphite-app graphite-app bot merged commit 2d63704 into main Mar 18, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 03-18-perf_ast_re-order_variabledeclarationkind_variants branch March 18, 2025 07:46
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST 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