Add a benchmark for regex related practices #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The first benchmark compares a regex with start/end anchors and the match method versus a regex with no anchors and the fullmatch method. I believe those should be equivalent functionally and was curious if the performance would vary. I do generally see better performance on the second, but it's usually below 10%, and its not always better, so maybe that benchmark should be thrown away?
The second benchmark compares using re.IGNORECASE with a regex looking for [a-z] versus a regex that specifies [a-zA-Z ] but has no flag. That seems to reliably get good performance improvements (~20-25%).