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

Upgrade to Syn 0.15 #19

Merged
merged 2 commits into from
Oct 17, 2018
Merged

Upgrade to Syn 0.15 #19

merged 2 commits into from
Oct 17, 2018

Conversation

dtolnay
Copy link
Contributor

@dtolnay dtolnay commented Oct 16, 2018

Some ideas for how I would implement the Syn upgrade. I am going to be busy for the rest of the week so feel free to take any ideas from here and incorporate into #18 as makes sense.

#18 mentioned a performance degradation -- I added a benchmark and found that this PR improves parsing performance by about 20% compared to Syn 0.14. You can confirm by running cargo bench against the first commit which just adds the benchmark, and against the second commit which contains the 0.15 code.


impl Parse for Repetition {
fn parse(input: ParseStream) -> Result<Self> {
if input.parse::<Option<Token![*]>>()?.is_some() {
Copy link
Owner

Choose a reason for hiding this comment

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

My spider senses are tickling here: IIRC there is a change in the 2018 edition in order to disambiguate repetition markers from separators. Maybe we will need a knob here in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, you're thinking of rust-lang/rust#51934. What I implemented is the 2018 behavior. Using ? as a repetition separator in 2015 would be so unusual that I wouldn't worry about it in this library.

@lukaslueg lukaslueg merged commit f9bc94f into lukaslueg:master Oct 17, 2018
@dtolnay dtolnay deleted the syn branch October 17, 2018 20:10
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.

2 participants