-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
reader: Improve performance of read_all #441
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c9d336a
to
43dbdfb
Compare
Benchmark for b49a65cClick to view benchmark
|
Benchmark for 7f81f7bClick to view benchmark
|
Benchmark for 42291ccClick to view benchmark
|
Benchmark for a473082Click to view benchmark
|
43dbdfb
to
696adb2
Compare
Benchmark for e1f913aClick to view benchmark
|
Benchmark for 8c98ec9Click to view benchmark
|
833f696
to
558ed33
Compare
Benchmark for d2397b4Click to view benchmark
|
Benchmark for 9ff94ecClick to view benchmark
|
558ed33
to
0b22526
Compare
For reference, not as perf as it was ;)
|
Benchmark for bd2a83cClick to view benchmark
|
Hmmm, my inline(never) hurt the performance of the count vs read_all. I might have to balance this..
|
Or! Just take the improvements and go to sleep ;) |
0b22526
to
03ff770
Compare
Benchmark for 5f329baClick to view benchmark
|
* Add Leftover::{Byte, Bits}, so that instead of conversion straight away into a Bitvec, we keep it as a slice instead. In the case of the read_all attribute this improves the speed, as reading until EOF doesn't keep causing our reader to convert to bits and back again all the time. * This _does_ result in some slowdown, but with some #[inline(never)] we can keep it to a minimum. The total gain to read_all speed is worth any .8 ms slowdown I saw in testing.
* This was causing issues with bit_size of buf, and BitSize already takes care of this
03ff770
to
312cbad
Compare
sharksforarms
approved these changes
Sep 3, 2024
wcampbell0x2a
added a commit
that referenced
this pull request
Sep 4, 2024
* reader: Improve performance of read_all * Add Leftover::{Byte, Bits}, so that instead of conversion straight away into a Bitvec, we keep it as a slice instead. In the case of the read_all attribute this improves the speed, as reading until EOF doesn't keep causing our reader to convert to bits and back again all the time. * This _does_ result in some slowdown, but with some #[inline(never)] we can keep it to a minimum. The total gain to read_all speed is worth any .8 ms slowdown I saw in testing. * Always use BitSize for bit read * This was causing issues with bit_size of buf, and BitSize already takes care of this
wcampbell0x2a
added a commit
that referenced
this pull request
Sep 4, 2024
* reader: Improve performance of read_all * Add Leftover::{Byte, Bits}, so that instead of conversion straight away into a Bitvec, we keep it as a slice instead. In the case of the read_all attribute this improves the speed, as reading until EOF doesn't keep causing our reader to convert to bits and back again all the time. * This _does_ result in some slowdown, but with some #[inline(never)] we can keep it to a minimum. The total gain to read_all speed is worth any .8 ms slowdown I saw in testing. * Always use BitSize for bit read * This was causing issues with bit_size of buf, and BitSize already takes care of this
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Leftover::{Byte, Bits}, so that instead of conversion straight away
into a Bitvec, we keep it as a slice instead. In the case of the read_all
attribute this improves the speed, as reading until EOF doesn't keep
causing our reader to convert to bits and back again all the time.
This does result in some slowdown, but with some #[inline(never)]
we can keep it to a minimum. The total gain to read_all speed is
worth any .8 ms slowdown I saw in testing.
Closes #439