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

Add a specialization of read_exact for Cursor. #46485

Merged
merged 1 commit into from
Dec 4, 2017

Conversation

khuey
Copy link
Contributor

@khuey khuey commented Dec 4, 2017

The read_exact implementation for &[u8] is optimized and usually allows LLVM to reduce a read_exact call for small numbers of bytes to a bounds check and a register load instead of a generic memcpy. On a workload I have that decompresses, deserializes (via bincode), and processes some data, this leads to a 40% speedup by essentially eliminating the deserialization overhead entirely.

The read_exact implementation for &[u8] is optimized and usually allows LLVM to reduce a read_exact call for small numbers of bytes to a bounds check and a register load instead of a generic memcpy.  On a workload I have that decompresses, deserializes (via bincode), and processes some data, this leads to a 40% speedup by essentially eliminating the deserialization overhead entirely.
@khuey
Copy link
Contributor Author

khuey commented Dec 4, 2017

Cc @Manishearth

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 4, 2017
@Manishearth
Copy link
Member

@bors r+

Seems innocuous; shouldn't change any behavior.

@bors
Copy link
Contributor

bors commented Dec 4, 2017

📌 Commit 02c1862 has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Dec 4, 2017

⌛ Testing commit 02c1862 with merge c16f480...

bors added a commit that referenced this pull request Dec 4, 2017
Add a specialization of read_exact for Cursor.

The read_exact implementation for &[u8] is optimized and usually allows LLVM to reduce a read_exact call for small numbers of bytes to a bounds check and a register load instead of a generic memcpy.  On a workload I have that decompresses, deserializes (via bincode), and processes some data, this leads to a 40% speedup by essentially eliminating the deserialization overhead entirely.
@bors
Copy link
Contributor

bors commented Dec 4, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: Manishearth
Pushing c16f480 to master...

@bors bors merged commit 02c1862 into rust-lang:master Dec 4, 2017
@khuey khuey deleted the cursor-read_exact branch December 4, 2017 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants