-
Notifications
You must be signed in to change notification settings - Fork 37
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
Generated Pread code is large/slow #53
Comments
@jrmuizel Any chance for a brief write-up of this so others could take it up? |
Sorry for taking so long to respond. So there are some different approaches to this. The simplest is to add unsafe trait with a method like size() -> Option. This would return Some(size) for structs that have a fixed size serialization. The generated deserialization code can then look something like: if Some(size) = self.size() {
// length check
unsafe {
field1 = unchecked_deserialize();
field2 = unchecked_deserialize();
}
...
} else {
... current deserialization code
} If we want to handle structs that have different serialized sizes efficiently than a more complicated strategy is needed like: https://github.com/jrmuizel/fast-serialization Let me know if you want more details or have other questions. |
not sure what's actionable here; please reopen if have other ideas or what specifically could be done scroll side, or whether issue needs to be filed upstream |
The following rust code:
compiles to:
It would be nice if make() compiled to a single length check and a single memcpy for all of the fields. We did some work on improving bincode's deserialization code for WebRender and I have a rough idea for how to fix this.
cc: @mystor, @gankro, @mstange
The text was updated successfully, but these errors were encountered: