Skip to content

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