Skip to content

perf(transformer): avoid unneccessary vec allocation#17270

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/12-22-perf_transformer_avoid_unneccessary_vec_allocation
Dec 22, 2025
Merged

perf(transformer): avoid unneccessary vec allocation#17270
graphite-app[bot] merged 1 commit intomainfrom
c/12-22-perf_transformer_avoid_unneccessary_vec_allocation

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Dec 22, 2025

avoid collecting into a vec when extends can accept an iterator instead

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-performance Category - Solution not expected to change functional behavior, only performance labels Dec 22, 2025
Copy link
Contributor Author

camc314 commented Dec 22, 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.

@camc314 camc314 marked this pull request as ready for review December 22, 2025 12:28
Copilot AI review requested due to automatic review settings December 22, 2025 12:28
@camc314 camc314 requested a review from Dunqing as a code owner December 22, 2025 12:28
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 optimizes performance by eliminating an unnecessary intermediate Vec allocation. Instead of collecting an iterator into a Vec and then extending another collection with it, the code now directly extends with the iterator, as the extend method accepts any type implementing IntoIterator.

Key Changes:

  • Removed intermediate .collect::<Vec<_>>() call when extending temp_decls
  • Simplified code by directly passing the iterator to extend()

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

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 22, 2025

CodSpeed Performance Report

Merging #17270 will not alter performance

Comparing c/12-22-perf_transformer_avoid_unneccessary_vec_allocation (5634053) with main (4ac23e1)

Summary

✅ 38 untouched
⏩ 7 skipped1

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.

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Dec 22, 2025
Copy link
Member

Dunqing commented Dec 22, 2025

Merge activity

avoid collecting into a vec when extends can accept an iterator instead
@graphite-app graphite-app bot force-pushed the c/12-22-perf_transformer_avoid_unneccessary_vec_allocation branch from 5634053 to e35049b Compare December 22, 2025 12:44
@graphite-app graphite-app bot merged commit e35049b into main Dec 22, 2025
20 checks passed
@graphite-app graphite-app bot deleted the c/12-22-perf_transformer_avoid_unneccessary_vec_allocation branch December 22, 2025 12:50
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 22, 2025
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.

4 participants