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

compile: add fast path for c_char #658

Merged
merged 1 commit into from
Mar 24, 2020
Merged

compile: add fast path for c_char #658

merged 1 commit into from
Mar 24, 2020

Conversation

BurntSushi
Copy link
Member

This fixes a pretty bad performance bug in the NFA compiler. In
particular, c_char was implemented by diverting to c_class, which is
correct, but rather costly to do for every single character in a regex.
This causes way more things than necessary to go through the class
compilation infrastructure, which includes the suffix caching.

We fix this by just special casing c_char. This speeds up regex
compilation in #657 by around 30%.

Fixes #657

This fixes a pretty bad performance bug in the NFA compiler. In
particular, c_char was implemented by diverting to c_class, which is
correct, but rather costly to do for every single character in a regex.
This causes way more things than necessary to go through the class
compilation infrastructure, which includes the suffix caching.

We fix this by just special casing c_char. This speeds up regex
compilation in #657 by around 30%.

Fixes #657
@BurntSushi BurntSushi merged commit 85ac385 into master Mar 24, 2020
@BurntSushi BurntSushi deleted the ag/fix-657 branch March 24, 2020 22:56
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.

Slow compilation for big bytes pattern
1 participant