Skip to content

perf(mangler): do not sort Vec if empty#13461

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-31-perf_mangler_do_not_sort_vec_if_empty
Aug 31, 2025
Merged

perf(mangler): do not sort Vec if empty#13461
graphite-app[bot] merged 1 commit intomainfrom
08-31-perf_mangler_do_not_sort_vec_if_empty

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Aug 31, 2025

Tiny optimization to mangler. We sort a Vec and then check if it's empty. Move the empty check to be first, so can skip sorting in that case.

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Aug 31, 2025
Copy link
Member Author

overlookmotel commented Aug 31, 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 August 31, 2025 10:21
Copilot AI review requested due to automatic review settings August 31, 2025 10:21
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 small performance optimization in the mangler by reordering an empty check before a sort operation to avoid unnecessary sorting of empty vectors.

  • Moves the empty check for tmp_bindings before the sort_unstable() call
  • Prevents sorting when the vector is empty, saving computational cycles

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 31, 2025

CodSpeed Instrumentation Performance Report

Merging #13461 will not alter performance

Comparing 08-31-perf_mangler_do_not_sort_vec_if_empty (caf40c5) with main (b92fa4f)1

Summary

✅ 37 untouched benchmarks

Footnotes

  1. No successful run was found on main (caf40c5) during the generation of this report, so b92fa4f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Aug 31, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 31, 2025

Merge activity

Tiny optimization to mangler. We sort a `Vec` and then check if it's empty. Move the empty check to be first, so can skip sorting in that case.
@graphite-app graphite-app bot force-pushed the 08-31-perf_mangler_do_not_sort_vec_if_empty branch from e24e10e to caf40c5 Compare August 31, 2025 10:25
@graphite-app graphite-app bot merged commit caf40c5 into main Aug 31, 2025
23 of 24 checks passed
@graphite-app graphite-app bot deleted the 08-31-perf_mangler_do_not_sort_vec_if_empty branch August 31, 2025 10:30
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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