Visitar URL original
Remove extraneous branch from push by mpdn · Pull Request #241 · servo/rust-smallvec · GitHub
Skip to content

Remove extraneous branch from push - #241

Merged
bors-servo merged 1 commit into
servo:masterfrom
mpdn:master
Nov 30, 2020
Merged

bors-servo merged 1 commit into
servo:masterfrom
mpdn:master

Conversation

@mpdn

@mpdn mpdn commented Nov 30, 2020 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

@bors-servo r+

Thanks!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 79f4132 has been approved by mbrubeck

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 79f4132 with merge c3e8aa3...

@bors-servo

Copy link
Copy Markdown
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.

3 participants