Skip to content

refactor: reduce allocations in no_mentions #1931

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

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

snprajwal
Copy link
Contributor

@snprajwal snprajwal commented Apr 11, 2025

This patch adds the below optimisations:

  • Allocate a single formatted string for the list of commits instead of a mutable vector which may possibly be resized at runtime.
  • Use a single format! to build the full warning string.
  • Eliminate the mentions_in_commits_warn function which moved the vector in the parameter and allocated a new string.

r? @Urgau

@snprajwal snprajwal force-pushed the optimise-no-mentions branch from 3cdbf14 to 53435a7 Compare April 11, 2025 19:30
This patch adds the below optimisations:

- Allocate a single formatted string for the list of commits instead of
  a mutable vector which may possibly be resized at runtime.
- Use a single `format!` to build the full warning string.
- Eliminate the `mentions_in_commits_warn` function which moved the
  vector in the parameter and allocated a new string.

Signed-off-by: Prajwal S N <[email protected]>
@snprajwal snprajwal force-pushed the optimise-no-mentions branch from 53435a7 to e839883 Compare April 11, 2025 19:31
@Urgau Urgau added this pull request to the merge queue Apr 11, 2025
Merged via the queue into rust-lang:master with commit 5b6f968 Apr 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants