-
Notifications
You must be signed in to change notification settings - Fork 226
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
Use set-len when reading into buffer #471
Conversation
8a0faba
to
9ad9cfd
Compare
Thanks for all performance-related improvements, @alexheretic! Once this one is merged, we'll be good to go with the release, right? (you don't plan further optimizations for now, do you? 🙂 ) |
I don't have anything queued up no 😅 so if you're happy with all the API changes then a new release is fine by me 👍 |
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.
I'm pretty sure this is unsound. A dodgy but valid Read::read impl is able to read the uninitialised bytes.
Ok thanks, on re-reading Read docs it does indeed clarify this. I'll raise a pr changing this back to zero filling then. |
Great point! I also have not thought about that until now.
But at the same time it explicitly says:
@alexheretic, I assume I can release a new patch version with just reverted change (the previous implementation was sound and not much slower anyway as you mentioned) UPD: published 0.26.1. |
I'd rather remove just the set_len usage than revert the whole pr... but I guess it isn't a big deal |
Makes sense! NB: I've already published 0.26.1 with the commit reverted (I just immediately followed my reflexes and reverted the commit "just to be on the safe side" right away so that we have a safe published version before someone starts actively using 0.26.0) |
Minor optimisation of read buffer logic using
set_len
to avoid writing zeroes, more worthwhile if configuring large read buffer sizes.Also simplified the code a bit using the buffer directly instead of split_off + unsplit.