Skip to content

Remove unnecessary allocations / clones during method lookup #14563

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
May 31, 2014

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented May 31, 2014

By dropping the intermediate vector that holds the relevant candidates
including duplicates and directly building the vector that has the
duplicates removed we can eliminate quite a few allocations. This
reduces the times for type checking by 5-10% (measured with libstd,
libsyntax and librustc).

continue;
} else {
merged.push(candidate_a.clone());
candidates_same
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you skip the local variable and just "return" the match directly?

By dropping the intermediate vector that holds the relevant candidates
including duplicates and directly building the vector that has the
duplicates removed we can eliminate quite a few allocations. This
reduces the times for type checking by 5-10% (measured with libstd,
libsyntax and librustc).
bors added a commit that referenced this pull request May 31, 2014
By dropping the intermediate vector that holds the relevant candidates
including duplicates and directly building the vector that has the
duplicates removed we can eliminate quite a few allocations. This
reduces the times for type checking by 5-10% (measured with libstd,
libsyntax and librustc).
@bors bors closed this May 31, 2014
@bors bors merged commit cd844c5 into rust-lang:master May 31, 2014
@alexcrichton
Copy link
Member

Nice wins!

@dotdash dotdash deleted the clone_kill branch May 31, 2014 17:30
bors pushed a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2025
This PR enables to the canonicalization of issue links in triagebot.

Documentation pending at
rust-lang/rust-forge#825

changelog: add `[canonicalize-issue-links]` in `triagebot.toml`
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.

4 participants