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

Remove extraneous branch from push #241

Merged
merged 1 commit into from Nov 30, 2020
Merged

Remove extraneous branch from push #241

merged 1 commit into from Nov 30, 2020

Conversation

mpdn
Copy link
Contributor

@mpdn mpdn commented Nov 30, 2020

push does two branches on the "smallness" of the smallvec: one before the reserve check and one after. LLVM doesn't seem to optimize the second branch away for the (very common) non-growing case. In addition, in the growing branch we know the memory will be on the heap, so no need to branch here.

On my machine, this improves bench_push from approx 300ns to 263ns (+/- 5 on both).

@mbrubeck
Copy link
Collaborator

@bors-servo r+

Thanks!

@bors-servo
Copy link
Contributor

📌 Commit 79f4132 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

⌛ Testing commit 79f4132 with merge c3e8aa3...

@bors-servo
Copy link
Contributor

☀️ Test successful - checks-travis
Approved by: mbrubeck
Pushing c3e8aa3 to master...

@bors-servo bors-servo merged commit c3e8aa3 into servo:master Nov 30, 2020
mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Dec 4, 2020
Release notes:

* Improve performance of `push` (servo#241).
@mbrubeck mbrubeck mentioned this pull request Dec 4, 2020
bors-servo added a commit that referenced this pull request Dec 4, 2020
Version 1.5.1

Release notes:

* Improve performance of `push` (#241).
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.

None yet

3 participants