-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.Text.RegularExpressionstenet-performancePerformance related issuePerformance related issue
Milestone
Description
Lazy loops currently push/pop more state on to the backtracking stack than is generally necessary. This can be improved.
runtime/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Lines 3188 to 3197 in 6aff1a3
| // PERFORMANCE TODO: | |
| // If we're inside of an outer loop, all of this state needs to be pushed on to the backtracking | |
| // stack, since a subsequent iteration of that outer loop could overwrite it. But if we're | |
| // not inside of another loop, locals dedicated to this construct can store the data, as nothing | |
| // else will overwrite them before we need them again. There are lots of combinations to think | |
| // through in this case, however, so it's something to follow-up on. | |
| // Additionally, we only need sawEmpty if it's even possible for the child to match empty, | |
| // which we can compute using node.Child(0).ComputeMinLength() == 0. We should be able to | |
| // avoid all of the checks related to sawEmpty if ComputeMinLength() > 0, and potentially | |
| // storing startingPos either. |
Metadata
Metadata
Assignees
Labels
area-System.Text.RegularExpressionstenet-performancePerformance related issuePerformance related issue