Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Perf -10%] System.Text.RegularExpressions.Tests.Perf_Regex_Common (2) #40094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DrewScoggins opened this issue Jul 29, 2020 · 9 comments · Fixed by #40162
Closed

[Perf -10%] System.Text.RegularExpressions.Tests.Perf_Regex_Common (2) #40094

DrewScoggins opened this issue Jul 29, 2020 · 9 comments · Fixed by #40162
Assignees
Labels
arch-x64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-windows tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark
Milestone

Comments

@DrewScoggins
Copy link
Member

Run Information

Architecture x64
OS Windows 10.0.18362
Changes diff

Regressions in System.Text.RegularExpressions.Tests.Perf_Regex_Common

Benchmark Baseline Test Test/Base Modality Baseline Outlier
Email_IsNotMatch 354.11 ns 380.00 ns 1.07 True
Email_IsMatch 257.82 ns 289.67 ns 1.12 True

graph
graph
Historical Data in Reporting System

Repro

git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f netcoreapp5.0 --filter 'System.Text.RegularExpressions.Tests.Perf_Regex_Common*';

Histogram

System.Text.RegularExpressions.Tests.Perf_Regex_Common.Email_IsNotMatch(Options: IgnoreCase, Compiled)

[351.514 ; 362.555) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[362.555 ; 375.809) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[375.809 ; 394.434) | @@@@@@@@@@@@@@@@@@@@@@@@

System.Text.RegularExpressions.Tests.Perf_Regex_Common.Email_IsMatch(Options: IgnoreCase, Compiled)

[255.611 ; 262.054) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[262.054 ; 267.995) | @@@@@@@@@@@@@@@@@@@@@@
[267.995 ; 274.438) | 
[274.438 ; 279.884) | 
[279.884 ; 286.328) | @@
[286.328 ; 295.294) | @@@@@@@@@@@@@@@@@@@@@

Docs

Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Text.RegularExpressions untriaged New issue has not been triaged by the area owner labels Jul 29, 2020
@ghost
Copy link

ghost commented Jul 29, 2020

Tagging subscribers to this area: @eerhardt, @pgovind
See info in area-owners.md if you want to be subscribed.

@DrewScoggins DrewScoggins added arch-x64 os-windows tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark labels Jul 29, 2020
@danmoseley
Copy link
Member

danmoseley commented Jul 29, 2020

@DrewScoggins thanks for the tightly bounded diff. IThere were no regex changes since July 16th.

There are only two commits in that diff that are even slightly plausibly related

@davidwrighton Fix CanCastTo behavior (#39915) … 13fa14e
@erozenfeld Fix fgUpdateChangedFlowGraph. (#39878) … b179d69

eyeballing the raw graph, I get a slightly larger bracket. This change may also have been in those bounds:

@davidwrighton Fix issue in type equivalence involving arrays (#39914) … 90989b4

@davidwrighton @erozenfeld can you conceive of either of these causing this regression?

@danmoseley
Copy link
Member

Looking at the 2nd test, I think @DrewScoggins tighter bracket is the correct one.

@DrewScoggins did you see any other regressions in other scenarios during those 3 hours, can you check?

@DrewScoggins
Copy link
Member Author

I believe that this test also regressed during the same gap, #40088

@danmoseley
Copy link
Member

OK, I'm inclined to put this in codegen area, but I am interested in @erozenfeld thoughts.

@erozenfeld
Copy link
Member

#39878 had codegen diffs in System.Text.RegularExpressions so it's possible it caused this regression. I'll investigate.

@erozenfeld erozenfeld self-assigned this Jul 29, 2020
@danmoseley danmoseley added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI and removed area-System.Text.RegularExpressions labels Jul 29, 2020
@danmoseley
Copy link
Member

OK thanks @erozenfeld

@danmoseley
Copy link
Member

Hooray for (1) prompt detection of a performance regression (2) useful issue that allowed us to narrow it down quickly

@erozenfeld erozenfeld added this to the 5.0.0 milestone Jul 29, 2020
@AndyAyersMS AndyAyersMS removed the untriaged New issue has not been triaged by the area owner label Jul 30, 2020
erozenfeld added a commit to erozenfeld/runtime that referenced this issue Jul 30, 2020
In dotnet#39878 I switched fgUpdateChangedFlowGraph to call fgComputeReachability,
which both removes unreachable blocks and calls fgComputeDoms. As mentioned
in that PR, in addition to removing unreachable blocks fgRemoveUnreachableBlocks
updates `BBF_LOOP_HEAD` flags even if no unreachable blocks were found. That resulted
in some diffs, both positive and negative, from downstream effects: e.g., in some cases
we now recognize more loops, which changes weights, etc.

Some of the negative diffs affected benchmarks we are tracking, e.g., in dotnet#40094
`System.Text.RegularExpressions.Tests.Perf_Regex_Common` had a 10% regression
because of codegen diffs in the large dynamic method created when compiling regular expressions.

Because of these regressions, I decided to go with a more surgical fix for the original issue (assert when
computing dominators after inlining GC polls). The downstream phases don't really need the dominator
info so I changed fgUpdateChangedFlowGraph to not re-compute dominators after GC poll inlining.

This reverses all diffs from dotnet#39878 and fixes dotnet#40094.
erozenfeld added a commit that referenced this issue Jul 31, 2020
In #39878 I switched fgUpdateChangedFlowGraph to call fgComputeReachability,
which both removes unreachable blocks and calls fgComputeDoms. As mentioned
in that PR, in addition to removing unreachable blocks fgRemoveUnreachableBlocks
updates `BBF_LOOP_HEAD` flags even if no unreachable blocks were found. That resulted
in some diffs, both positive and negative, from downstream effects: e.g., in some cases
we now recognize more loops, which changes weights, etc.

Some of the negative diffs affected benchmarks we are tracking, e.g., in #40094
`System.Text.RegularExpressions.Tests.Perf_Regex_Common` had a 10% regression
because of codegen diffs in the large dynamic method created when compiling regular expressions.

Because of these regressions, I decided to go with a more surgical fix for the original issue (assert when
computing dominators after inlining GC polls). The downstream phases don't really need the dominator
info so I changed fgUpdateChangedFlowGraph to not re-compute dominators after GC poll inlining.

This reverses all diffs from #39878 and fixes #40094.
@danmoseley
Copy link
Member

Looking even closer at the graph and zooming in, we actually could get a diff bounding just 3 hours of time on July 24th:
f3f23b4...6ca6003

Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this issue Aug 10, 2020
In dotnet#39878 I switched fgUpdateChangedFlowGraph to call fgComputeReachability,
which both removes unreachable blocks and calls fgComputeDoms. As mentioned
in that PR, in addition to removing unreachable blocks fgRemoveUnreachableBlocks
updates `BBF_LOOP_HEAD` flags even if no unreachable blocks were found. That resulted
in some diffs, both positive and negative, from downstream effects: e.g., in some cases
we now recognize more loops, which changes weights, etc.

Some of the negative diffs affected benchmarks we are tracking, e.g., in dotnet#40094
`System.Text.RegularExpressions.Tests.Perf_Regex_Common` had a 10% regression
because of codegen diffs in the large dynamic method created when compiling regular expressions.

Because of these regressions, I decided to go with a more surgical fix for the original issue (assert when
computing dominators after inlining GC polls). The downstream phases don't really need the dominator
info so I changed fgUpdateChangedFlowGraph to not re-compute dominators after GC poll inlining.

This reverses all diffs from dotnet#39878 and fixes dotnet#40094.
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-x64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-windows tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants