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

remove unsafe code in IoReader #309

Merged
merged 2 commits into from
Mar 20, 2020
Merged

remove unsafe code in IoReader #309

merged 2 commits into from
Mar 20, 2020

Conversation

ZoeyR
Copy link
Collaborator

@ZoeyR ZoeyR commented Mar 15, 2020

Fully fixes #260

I ran benchmarks with https://github.com/erickt/rust-serialization-benchmarks and couldn't find any appreciable difference in the time it took to execute. If anything, the new method runs faster.

Copy link
Contributor

@strega-nil strega-nil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you upload some graphs of the benchmarks? Otherwise, this is a great change imo!

@ZoeyR
Copy link
Collaborator Author

ZoeyR commented Mar 18, 2020

I tested on a different machine and got different results for which implementation came in first.
image

So based on the machine it might end up being slightly slower. I think the trade-off is still worth it to avoid undefined behaviour, especially in a serialization library that might interface with remote machines. Once rust resolves rust-lang/rust#42788 we can evaluate changing the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UB in IoReader::fill_buffer
2 participants