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

Optimize the token comparison #154

Merged
merged 1 commit into from
Nov 26, 2018

Conversation

stof
Copy link
Contributor

@stof stof commented Nov 24, 2018

Tokens are always a single char. Using strspn to find whether they belong to a fixed list is slower than comparing them directly.

Loading benchmark:
Before: 113.15485715866
After: 112.65460729599

That's not a huge difference, but it still helps.

@stof
Copy link
Contributor Author

stof commented Nov 24, 2018

I'm currently looking at better optimizations for these places, so I'm closing this PR for now.

@stof stof closed this Nov 24, 2018
@stof stof reopened this Nov 24, 2018
@stof
Copy link
Contributor Author

stof commented Nov 24, 2018

OK, reopening without the change in unquoted attributes (to avoid the conflicts with #155). The numbers still apply, as this benchmark was not using unquoted attributes.

@goetas
Copy link
Member

goetas commented Nov 25, 2018

because of recent CS changes, this requires to be rebased

@stof
Copy link
Contributor Author

stof commented Nov 26, 2018

@goetas done

@goetas
Copy link
Member

goetas commented Nov 26, 2018

cs failure

Tokens are always a single char. Using strspn to find whether they belong to
a fixed list is slower than comparing them directly.
@stof
Copy link
Contributor Author

stof commented Nov 26, 2018

Updated

@goetas goetas merged commit 3ed3bdc into Masterminds:master Nov 26, 2018
@goetas
Copy link
Member

goetas commented Nov 26, 2018

Thanks

@stof stof deleted the optimize_token_comparison branch November 26, 2018 18:00
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.

None yet

2 participants