Skip to content
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

Wasteful Vec allocation in read_string and read_vec #118

Closed
dtolnay opened this issue Feb 23, 2017 · 3 comments
Closed

Wasteful Vec allocation in read_string and read_vec #118

dtolnay opened this issue Feb 23, 2017 · 3 comments

Comments

@dtolnay
Copy link
Collaborator

@dtolnay dtolnay commented Feb 23, 2017

Every String and Vec<u8> deserialization (as of #115) allocates a fresh vector. From what we've seen in the JSON deserializer, reusing a long-lived buffer would be a huge improvement.

@khuey
Copy link
Contributor

@khuey khuey commented Feb 23, 2017

This optimization would only affect the deserialize_bytes case. Both deserialize_byte_buf and deserialize_string want to consume the buffer to produce zero-copy output.

@TyOverby
Copy link
Collaborator

@TyOverby TyOverby commented Feb 23, 2017

@khuey: also deserialize_str

@khuey
Copy link
Contributor

@khuey khuey commented Feb 23, 2017

Yes, forgot that one.

@TyOverby TyOverby closed this Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.