Skip to content

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
Collaborator

bors commented Dec 4, 2017

📌 Commit 02c1862 has been approved by Manishearth

@bors
Copy link
Collaborator

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
Collaborator

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