-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process "multi" strings in compiled regexes 4 or 2 chars at a time wh…
…en possible (#1654) * Process "multi" strings in compiled regexes 4 or 2 chars at a time when possible When we encounter a series of characters in a regex pattern, we emit a comparison check per character. This updates that codegen to compare 2 or 4 characters at a time, when possible. In general these sequences are not long, but they can easily be a handful of characters, and comparing with ints and longs instead of chars slightly improves both throughput and the size of the IL and JIT'd asm. * Address PR feedback And add a test. * Use StartsWith for long strings in EmitMultiChar Avoids potentially very long generated Go methods and the resulting long JIT times and potentially stack overflows at invocation time. Prior to this change, a test added for 100K-long string takes a very long time to run and then stack overflows, whereas with this change it's very fast. * Address PR feedback * Tweak test per PR feedback
- Loading branch information
1 parent
f7d2dbd
commit 9236c93
Showing
3 changed files
with
159 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters