Skip to content

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jul 5, 2016

This improves parser performance by 30-60% (that's right, more than 2x faster for many inputs). Performance when reading from other types of iterators is not affected.

The tests are going to require a Serde release containing serde-rs/serde#422 and serde-rs/serde#423.

@dtolnay
Copy link
Member Author

dtolnay commented Jul 5, 2016

There are some contortions to keep the new Read trait out of the public API and to not affect the type parameters on the Deserializer struct. This lets us replace the manual specialization with actual specialization once that feature is stable.

{
for (s, err) in errors {
match (err, from_str::<T>(s).unwrap_err()) {
for &(s, ref err) in &errors {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is because Error is not Copy or Clone so I need a reference in order to test both the error from from_str and the one from from_iter.

@oli-obk
Copy link
Member

oli-obk commented Jul 5, 2016

Those improvements are impressive. Code looks good to me.

@dtolnay dtolnay merged commit 7db3a1a into serde-rs:master Jul 6, 2016
@dtolnay dtolnay deleted the sliceread branch July 6, 2016 03:48
@serde-rs serde-rs deleted a comment from coveralls Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants