-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Is there a faster way to read large Vec<u8>? #462
Comments
For Since deku makes small repeated reads, using a https://doc.rust-lang.org/std/io/struct.BufReader.html should reduce the read overhead. |
Thanks for getting back so quickly! At the moment, our reader is already using a BufReader. We tried doing this in an attempt to speed it up, but unfortunately it's still much too slow when reading the vectors compared to our own read function. Would some kind of |
Definitely try out the merge request, it's really slow without that.
Sure, I don't have the code in front of me, but I think we only store leftover as a |
I also don't know, it could be an improvement in our impl of |
I will take a look, thanks :) |
* Add read_exact, which can only be used for Vec<u8> but allows faster reading that doesn't have ctx or limits. See #462
* Add read_exact, which can only be used for Vec<u8> but allows faster reading that doesn't have ctx or limits. See #462
* Add read_exact, which can only be used for Vec<u8> but allows faster reading that doesn't have ctx or limits. See #462
* Add read_exact, which can only be used for Vec<u8> but allows faster reading that doesn't have ctx or limits. See #462
* For Vec<u8> when using count, specialize into reading the bytes all at once See #462
* For Vec<u8> when using count, specialize into reading the bytes all at once See #462
@MeguminSama see the latest commits on master, they should solve most or all of your performance problems |
At the moment, say I have a struct like this:
The problem, is that deku seems to loop through the reader for each u8 in bytes_read. This causes it to be very slow on large vectors.
#[deku(read_all)]
and#[deku(count = "size")]
are also very slow.At the moment, we're using our own read function to do something like this:
Which is significantly faster.
But I was wondering if there was a built-in way to do this with deku, instead of deku looping over each u8?
If this isn't a feature currently, I might consider implementing it if it's something you'd want in deku.
Thanks!
The text was updated successfully, but these errors were encountered: