Make RegexCompiler-generated code more JIT friendly#35321
Merged
stephentoub merged 2 commits intodotnet:masterfrom Apr 25, 2020
Merged
Make RegexCompiler-generated code more JIT friendly#35321stephentoub merged 2 commits intodotnet:masterfrom
stephentoub merged 2 commits intodotnet:masterfrom
Conversation
|
Tagging subscribers to this area: @eerhardt |
96477ab to
16308aa
Compare
AndyAyersMS
reviewed
Apr 23, 2020
Member
AndyAyersMS
left a comment
There was a problem hiding this comment.
There are still a couple places that call Dup, though from what I can tell they won't result in multiple instances of dup in the IL stream, so there may not be much benefit from reworking those.
Member
Author
Only in FindFirstChar rather than Go, right? The latter can get huge; the former is generally much more constrained. So I really only focused on Go. |
Member
Author
|
Ah, there are still one or two in the newer Go implementation I added. I can look at removing those, too. |
- Prefer using stloc/ldloc over using dup, especially across branches. - Use call instead of callvirt where applicable. - Use shorter form of some instructions
16308aa to
fb4dd2f
Compare
Member
Author
|
Thanks for the push, Andy. I decided to just go and delete the rest of the dups :) |
danmoseley
reviewed
Apr 23, 2020
...libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs
Show resolved
Hide resolved
eerhardt
approved these changes
Apr 25, 2020
...libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs
Show resolved
Hide resolved
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
On a customer-provided workload featuring several hundred complex regexes, this improves the time it takes to JIT the RegexCompiler-generated code and the time it takes to perform a bunch of matches by 15-20%.
cc: @AndyAyersMS, @eerhardt, @pgovind