Skip to content
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

perf(isolated_declarations): reduce looping over statements #9393

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Feb 26, 2025

Reduce number of loops over Program's statements.

  1. transform_program_without_module_declaration constructed a temporary Vec and then iterated over it to generate the final Vec. Cut out the intermediate Vec.
  2. transform_statements_on_demand created a Vec and then called retain on it to filter it down. Combine the Vec construction and filtering into a single loop.

The gain from (1) is larger, but only (2) will show up in our benchmark as it takes the transform_statements_on_demand path.

Copy link
Contributor Author

overlookmotel commented Feb 26, 2025


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.

@overlookmotel overlookmotel marked this pull request as ready for review February 26, 2025 12:44
Copy link

codspeed-hq bot commented Feb 26, 2025

CodSpeed Performance Report

Merging #9393 will not alter performance

Comparing 02-23-perf_isolated_declarations_reduce_looping_over_statements (df75980) with main (c880481)

Summary

✅ 33 untouched benchmarks

@overlookmotel
Copy link
Contributor Author

Ha! Perf actually regresses a little. I'll have to look deeper.

@overlookmotel overlookmotel marked this pull request as draft February 26, 2025 12:53
@Boshen Boshen changed the base branch from 02-23-refactor_isolated_declarations_rename_var to graphite-base/9393 February 26, 2025 13:15
@Boshen Boshen force-pushed the graphite-base/9393 branch from e4c1977 to c880481 Compare February 26, 2025 13:29
@Boshen Boshen force-pushed the 02-23-perf_isolated_declarations_reduce_looping_over_statements branch from 5a7d54e to 6836790 Compare February 26, 2025 13:29
@Boshen Boshen changed the base branch from graphite-base/9393 to main February 26, 2025 13:30
@Boshen Boshen force-pushed the 02-23-perf_isolated_declarations_reduce_looping_over_statements branch from 6836790 to df75980 Compare February 26, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-isolated-declarations Isolated Declarations 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.

1 participant