-
Notifications
You must be signed in to change notification settings - Fork 248
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
Archiving optimizations #224
Conversation
…special wrapper and a bit of `unsafe`
…hiving` even in debug builds to make erasure coding not as painfully slow
b82b4fc
to
77a8246
Compare
@@ -274,13 +272,27 @@ impl FlatPieces { | |||
pub fn into_inner(self) -> Vec<u8> { | |||
self.0 | |||
} | |||
|
|||
/// Iterator over individual pieces as byte slices. | |||
pub fn as_pieces(&self) -> impl ExactSizeIterator<Item = &[u8]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a bunch of pieces.as_pieces()
which just sounds like pieces as pieces, perhaps better to use flat_pieces.as_pieces
in these cases. Just a thought, feel free to ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few places where it can be done, but I don't think it can be done everywhere while making perfect sense. Let's keep this in mind and maybe refactor in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
The amount of memory copying and allocations in archiving bothered me for a while and I decided to finally optimize it.
The result is ~3% improvement on added benchmark. I didn't know what to expect, but I'm happy that there is an improvement.
I also enabled optimizations for some crates so I don't have to compile everything in debug mode for erasure coding to not take forever.