Skip to content

JIT: defer some flow graph reordering until after loop recognition - #69878

Merged
AndyAyersMS merged 2 commits into
dotnet:mainfrom
AndyAyersMS:MoveOptOptimizeLayoutLaterInPhaseListx2
May 30, 2022
Merged

JIT: defer some flow graph reordering until after loop recognition#69878
AndyAyersMS merged 2 commits into
dotnet:mainfrom
AndyAyersMS:MoveOptOptimizeLayoutLaterInPhaseListx2

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

The JIT currently will aggressively reorder the flow graph before running its
loop recognition phases. When there is PGO data this sometimes perturbs the
block order so that loops are no longer recognized, and we miss out on some
loop optimizations.

This change defers most block reordering until after the JIT has gone through
the optimization phases. There is still a limited form of flow cleanup done
early on.

There is also a compensating change in loop recognition in one place where it was
relying on adjacent blocks being combined.

Fixes#67318.

The JIT currently will aggressively reorder the flow graph before running its
loop recognition phases. When there is PGO data this sometimes perturbs the
block order so that loops are no longer recognized, and we miss out on some
loop optimizations.
This change defers most block reordering until after the JIT has gone through
the optimization phases. There is still a limited form of flow cleanup done
early on.
There is also a compensating change in loop recognition in one place where it was
relying on adjacent blocks being combined.
Fixesdotnet#67318.
@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 26, 2022
@ghost

Copy link
Copy Markdown

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

Issue Details

The JIT currently will aggressively reorder the flow graph before running its
loop recognition phases. When there is PGO data this sometimes perturbs the
block order so that loops are no longer recognized, and we miss out on some
loop optimizations.

This change defers most block reordering until after the JIT has gone through
the optimization phases. There is still a limited form of flow cleanup done
early on.

There is also a compensating change in loop recognition in one place where it was
relying on adjacent blocks being combined.

Fixes #67318.

Author:AndyAyersMS
Assignees:-
Labels:

area-CodeGen-coreclr

Milestone:-

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

@BruceForstall PTAL
cc @dotnet/jit-contrib

This is going to lead to a massive number of diffs. There's no way I've found to incrementally approach this.

If/when we go to a more graph-based loop recognition we can reconsider, but in general we should not be concerned with block ordering early on in the phase pipeline. So I think deferring these sorts of ordering opts is the right long-term approach.

@BruceForstallBruceForstall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Will be interesting to see how the perf runs react.

Should run jitstress on this.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

Needed to pull in a bit more of fgCompactBlocks logic.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

@dotnet/dncenghot CI seems to be in a bad way

 Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/d1622942-d16f-48e5-bc83-96f4539e7601/nuget/v3/flat2/microsoft.extensions.dependencymodel/index.json'.
Response status code does not indicate success: 401 (Unauthorized - TF400813: Resource not available for anonymous access. Client authentication required. (DevOps Activity ID: 4CE74E9C-9CEC-474D-BC0C-08094706C5D6)).

@MattGal

Copy link
Copy Markdown
Member

@dotnet/dncenghot CI seems to be in a bad way

 Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/d1622942-d16f-48e5-bc83-96f4539e7601/nuget/v3/flat2/microsoft.extensions.dependencymodel/index.json'.
Response status code does not indicate success: 401 (Unauthorized - TF400813: Resource not available for anonymous access. Client authentication required. (DevOps Activity ID: 4CE74E9C-9CEC-474D-BC0C-08094706C5D6)).

@epananth can you handle this? Repro is as simple as going to https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/d1622942-d16f-48e5-bc83-96f4539e7601/nuget/v3/flat2/microsoft.netcore.app.ref/index.json from an incognito window; this should (and does with auth) serve up this:

{"$id":"1","innerException":null,"message":"Can't find the package 'microsoft.netcore.app.ref' in feed 'dotnet-tools'.","typeName":"Microsoft.VisualStudio.Services.NuGet.WebApi.Exceptions.PackageNotFoundException, Microsoft.VisualStudio.Services.NuGet.WebApi","typeKey":"PackageNotFoundException","errorCode":0,"eventId":3000}

but instead if prompts for auth despite dotnet-tools being a public feed.

@epananth

Copy link
Copy Markdown
Member

Yes on it

@epananth

Copy link
Copy Markdown
Member

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

Local x64 windows diff summary. Overall regression expected as we should be enabling more cloning.

aspnet 8765 total methods with Code Size differences (3416 improved, 5349 regressed), 1821 unchanged.
Total bytes of delta: 38659 (0.17% of base)
benchmarks 781 total methods with Code Size differences (442 improved, 339 regressed), 369 unchanged.
Total bytes of delta: -4627 (-0.05% of base)
clr.test 9817 total methods with Code Size differences (8460 improved, 1357 regressed), 1434 unchanged.
Total bytes of delta: -52739 (-0.04 % of base)
lib.cross 1515 total methods with Code Size differences (801 improved, 714 regressed), 956 unchanged.
Total bytes of delta: 3231 (0.01 % of base)
lib.pmi 11671 total methods with Code Size differences (6009 improved, 5662 regressed), 5132 unchanged.
Total bytes of delta: 67054 (0.13 % of base)
lib.test 36329 total methods with Code Size differences (14817 improved, 21512 regressed), 6302 unchanged.
Total bytes of delta: 134808 (0.10 % of base)

Generating all these dasm and rc took forever.

@AndyAyersMS

AndyAyersMS commented May 27, 2022

Copy link
Copy Markdown
MemberAuthor

SPMI for arm32 timed out, too many diffs to cope with (looks like it finished running but got killed before summary could upload)

...
[17:29:43] 27461 total methods with Code Size differences (10106 improved, 17355 regressed), 10037 unchanged.
[17:29:43] Elapsed time: 1:22:17.110646
['unix-arm' END OF WORK ITEM LOG: Command timed out, and was killed]

Artifacts for the libraries arm run missing so hard to say why it failed. Am going to retry.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr jitstress

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

Got an arm artifact from the failure this time, looks like something to investigate:

Assert failure(PID 23 [0x00000017], Thread: 64 [0x0040]): Assertion failed 'remainingSize == 4' in 'Microsoft.CodeAnalysis.CSharp.Formatting.NewLineUserSettingFormattingRule:WithOptions(Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions):Microsoft.CodeAnalysis.Formatting.Rules.AbstractFormattingRule:this' during 'Generate code' (IL size 31; hash 0x3116fdc4; Tier0)
File: /__w/1/s/src/coreclr/jit/codegenarmarch.cpp Line: 1119
Image: /root/helix/work/correlation/dotnet

@BruceForstall

BruceForstall commented May 27, 2022

Copy link
Copy Markdown
Contributor

Got an arm artifact from the failure this time, looks like something to investigate:

#60705

Seems to be happening more now

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

JitStress not happy.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

JitStress not happy.

No luck reproing this yet.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

JitStress not happy.

No luck reproing this yet.

My local build is a bit behind main, going to merge up.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

JitStress not happy.

No luck reproing this yet.

My local build is a bit behind main, going to merge up.

I can repro now, but kind of hard to believe this change is responsible.

There are very similar failures in https://dev.azure.com/dnceng/public/_build/results?buildId=1790509&view=ms.vss-test-web.build-test-results-tab which is a few days old.

So looks like jit stress is in a bad way in general. Last green was 9859f70 and the next rolling after that at 0dba0ee is in bad shape.

@AndyAyersMS

AndyAyersMS commented May 28, 2022

Copy link
Copy Markdown
MemberAuthor

JitStress not happy.

No luck reproing this yet.

My local build is a bit behind main, going to merge up.

I can repro now, but kind of hard to believe this change is responsible.

There are very similar failures in https://dev.azure.com/dnceng/public/_build/results?buildId=1790509&view=ms.vss-test-web.build-test-results-tab which is a few days old.

So looks like jit stress is in a bad way in general. Last green was 9859f70 and the next rolling after that at 0dba0ee is in bad shape.

Suspect this is related to the W^X changes. I can see the jit is crashing in emitter::emitOutputByte, seems like emitter::emitOutputAlign is not invoking it with the proper offset in its stress clause.

@drieseng

Copy link
Copy Markdown
Contributor

@AndyAyersMS Add test from #67318?

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

@AndyAyersMS Add test from #67318?

I have a follow-on change in the works where I'll add these...

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr jitstress

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@DrewScoggins

Copy link
Copy Markdown
Member

Improvements Arm64-Windows: dotnet/perf-autofiling-issues#5755

@AndyAyersMS

AndyAyersMS commented Jun 4, 2022

Copy link
Copy Markdown
MemberAuthor

We knew this PR was going to shake things up a bit ... here's an attempt to collect up all the reports we know of. Note many of these seemingly are duplicates.

Regressions

Improvements

@mrsharm

mrsharm commented Aug 10, 2022

Copy link
Copy Markdown
Member

@AndyAyersMS - we found the following regressions that seemed to line up with this PR. We detected this from our analysis while creating the perf report for August. Would you consider these regressions as "by design" as there are improvements associated with this PR as noted above.

Regressions:

  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "\p{Ll}", Options: NonBacktracking)
  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aei", Options: Compiled)
  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aqj", Options: Compiled)
  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aqj", Options: NonBacktracking)
  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aqj", Options: None)
  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "zqj", Options: Compiled)
  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "zqj", Options: NonBacktracking)
  • System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "zqj", Options: None)
  • System.Globalization.Tests.StringSearch.IndexOf_Word_NotFound(Options: (en-US, Ordinal, False))
  • System.Globalization.Tests.StringSearch.IndexOf_Word_NotFound(Options: (, IgnoreCase, False))
  • System.Globalization.Tests.StringSearch.IndexOf_Word_NotFound(Options: (en-US, IgnoreCase, False))
  • System.Globalization.Tests.StringSearch.LastIndexOf_Word_NotFound(Options: (en-US, IgnoreCase, False))
  • System.Globalization.Tests.StringSearch.IsSuffix_DifferentLastChar(Options: (en-US, Ordinal, False))
  • System.Linq.Tests.Perf_Enumerable.Count(input: IEnumerable)
  • System.IO.Tests.Perf_Path.GetDirectoryName
  • System.Tests.Perf_Double.Parse(value: "1.7976931348623157e+308")
  • System.Tests.Perf_Double.Parse(value: "-1.7976931348623157e+308")
  • System.Tests.Perf_Double.Parse(value: "12345")
  • System.Tests.Perf_Double.TryParse(value: "-1.7976931348623157e+308")
  • System.Tests.Perf_Double.TryParse(value: "1.7976931348623157e+308")
  • System.Tests.Perf_UInt64.TryParse(value: "18446744073709551615")
  • System.Tests.Perf_UInt16.TryParse(value: "12345")
  • System.Tests.Perf_Double.TryParse(value: "12345")
  • System.Tests.Perf_Double.TryParse(value: "1.7976931348623157e+308")

EDIT(s):

  1. Found more regressions related to *IndexOf_Word_NotFound particularly for the Ubuntu 18.04 x64 configuration:

Ubuntu 18.04 x64 - System.Globalization.Tests.StringSearch.LastIndexOf_Word_NotFound(Options: (en-US, IgnoreCase, False)):

image

  1. System.Linq.Tests.Perf_Enumerable.Count(input: IEnumerable):

image

  1. System.IO.Tests.Perf_Path.GetDirectoryName:

image

  1. System.Tests.Perf_Double.Parse, System.Tests.Perf_Double.TryParse and System.Tests.Perf_UInt64.TryParse that all have a similar shape as:

image

Details

System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "zqj", Options: None)

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same1.00+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.98+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Faster1.32+0macOS Monterey 12.3Arm64Apple M1 Max
Same0.97+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.02+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.01+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.02+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same1.01+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Same1.00+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same1.00+0Windows 11X64AMD Ryzen 9 3950X
Same1.00+0Windows 11X64AMD Ryzen 9 5900X
Same1.00+0Windows 11X64AMD Ryzen 9 5950X
Same1.04+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same0.96+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Same0.93+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.72+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Faster1.17+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Slower0.89+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.59+0ubuntu 20.04X64AMD Ryzen 9 5900X
Same0.90+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower0.69+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.83+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.17+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.86+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Same0.93+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Same0.89+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aqj", Options: None)

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same1.00+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.98+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Faster1.32+0macOS Monterey 12.3Arm64Apple M1 Max
Same1.04+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.96+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.99+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.97+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same0.99+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Faster1.31+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Faster1.30+0Windows 11X64AMD Ryzen 9 3950X
Same0.94+0Windows 11X64AMD Ryzen 9 5900X
Faster1.45+0Windows 11X64AMD Ryzen 9 5950X
Same1.00+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same0.94+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Same0.92+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.89+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Faster1.18+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Slower0.86+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.83+0ubuntu 20.04X64AMD Ryzen 9 5900X
Slower0.86+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower0.71+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.83+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.48+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.86+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Same0.93+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower0.89+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aei", Options: Compiled)

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same1.00+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.97+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Faster1.25+0macOS Monterey 12.3Arm64Apple M1 Max
Same1.00+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.99+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.03+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.03+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same1.00+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Same1.07+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same1.01+0Windows 11X64AMD Ryzen 9 3950X
Faster1.14+0Windows 11X64AMD Ryzen 9 5900X
Same1.01+0Windows 11X64AMD Ryzen 9 5950X
Same1.04+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same0.95+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Same0.90+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.78+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Faster1.26+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Same0.94+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.80+0ubuntu 20.04X64AMD Ryzen 9 5900X
Same0.90+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower0.74+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.78+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.70+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.89+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.82+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower0.89+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aqj", Options: Compiled)

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same1.00+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.98+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Faster1.32+0macOS Monterey 12.3Arm64Apple M1 Max
Same1.00+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.02+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.95+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.99+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same1.00+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Faster1.33+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.99+0Windows 11X64AMD Ryzen 9 3950X
Faster1.43+0Windows 11X64AMD Ryzen 9 5900X
Same0.99+0Windows 11X64AMD Ryzen 9 5950X
Same0.99+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same0.95+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Same0.94+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.72+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Faster1.18+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Same0.90+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.67+0ubuntu 20.04X64AMD Ryzen 9 5900X
Same0.92+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower0.71+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.71+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.31+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.88+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.80+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower0.88+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock.Count(Pattern: "aqj", Options: NonBacktracking)

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same1.00+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.98+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Faster1.32+0macOS Monterey 12.3Arm64Apple M1 Max
Same1.00+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.02+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.00+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.98+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same0.98+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Faster1.31+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Faster1.29+0Windows 11X64AMD Ryzen 9 3950X
Same0.92+0Windows 11X64AMD Ryzen 9 5900X
Faster1.45+0Windows 11X64AMD Ryzen 9 5950X
Same1.02+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same0.93+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Same0.93+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.72+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Faster1.18+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Same0.90+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.83+0ubuntu 20.04X64AMD Ryzen 9 5900X
Same1.14+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower0.69+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.63+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.30+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.88+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Same0.93+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower0.88+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Globalization.Tests.StringSearch.IndexOf_Word_NotFound(Options: (en-US, Ordinal, False))

ResultBaseDiffRatioAlloc DeltaOperating SystemBitProcessor NameModality
Same64.4665.080.99+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same63.9964.311.00+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Faster29.3422.671.29+0macOS Monterey 12.3Arm64Apple M1 Max
Same21.0522.060.95+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same22.3520.911.07+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Faster24.0620.221.19+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same26.0926.141.00+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same16.8716.721.01+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Same15.9615.901.00+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same17.5016.761.04+0Windows 11X64AMD Ryzen 9 3950X
Same11.3311.680.97+0Windows 11X64AMD Ryzen 9 5900X
Same12.1812.670.96+0Windows 11X64AMD Ryzen 9 5950X
Same18.7918.851.00+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same15.5915.870.98+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Slower15.7519.990.79+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower19.3822.350.87+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same61.1660.971.00+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Same19.1520.720.92+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower11.3016.190.70+0ubuntu 20.04X64AMD Ryzen 9 5900X
Slower15.2619.060.80+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower20.4826.770.76+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHzseveral?
Slower20.0424.960.80+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower15.9619.290.83+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower24.8329.230.85+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower22.5826.930.84+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower24.7529.040.85+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Globalization.Tests.StringSearch.LastIndexOf_Word_NotFound(Options: (en-US, IgnoreCase, False))

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same0.98+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.99+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.30+0macOS Monterey 12.3Arm64Apple M1 Max
Same1.11+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.05+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.93+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.03+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same1.03+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Same0.98+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same1.00+0Windows 11X64AMD Ryzen 9 3950X
Same1.01+0Windows 11X64AMD Ryzen 9 5900X
Same0.96+0Windows 11X64AMD Ryzen 9 5950X
Same1.00+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same1.07+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Same0.94+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.81+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.93+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Slower0.63+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.82+0ubuntu 20.04X64AMD Ryzen 9 5900X
Slower0.80+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Same0.96+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.00+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.02+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.80+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.82+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower0.79+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Globalization.Tests.StringSearch.IsSuffix_DifferentLastChar(Options: (en-US, Ordinal, False))

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same0.99+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.96+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same1.03+0macOS Monterey 12.3Arm64Apple M1 Max
Same0.98+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.97+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.99+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.99+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same0.93+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Same0.97+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.97+0Windows 11X64AMD Ryzen 9 3950X
Same0.91+0Windows 11X64AMD Ryzen 9 5900X
Same0.97+0Windows 11X64AMD Ryzen 9 5950X
Same1.00+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same1.10+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Noise-+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.85+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Faster1.19+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Slower0.73+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.66+0ubuntu 20.04X64AMD Ryzen 9 5900X
Slower0.75+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Same1.04+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.91+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.01+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.85+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.84+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower0.84+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Linq.Tests.Perf_Enumerable.Count(input: IEnumerable)

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same1.02+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same1.00+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.99+0macOS Monterey 12.3Arm64Apple M1 Max
Same0.93+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.83+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.92+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.88+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Slower0.82+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Slower0.83+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.85+0Windows 11X64AMD Ryzen 9 3950X
Slower0.86+0Windows 11X64AMD Ryzen 9 5900X
Same1.00+0Windows 11X64AMD Ryzen 9 5950X
Same0.91+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.78+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Slower0.84+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Same0.95+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.09+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Same0.96+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same0.90+0ubuntu 20.04X64AMD Ryzen 9 5900X
Slower0.83+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower0.86+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.00+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.00+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same1.00+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Same0.95+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Same1.00+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.IO.Tests.Perf_Path.GetDirectoryName

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Faster1.22+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.99+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.48+0macOS Monterey 12.3Arm64Apple M1 Max
Same0.88+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.95+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.89+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.88+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same0.99+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Slower0.87+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.88+0Windows 11X64AMD Ryzen 9 3950X
Same0.96+0Windows 11X64AMD Ryzen 9 5900X
Slower0.81+0Windows 11X64AMD Ryzen 9 5950X
Slower0.87+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.88+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Slower0.81+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Same0.98+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.99+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Same1.03+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same1.00+0ubuntu 20.04X64AMD Ryzen 9 5900X
Same0.94+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Slower0.84+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.77+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.92+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same1.02+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Same1.02+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Same0.99+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

System.Tests.Perf_Double.Parse(value: "1.7976931348623157e+308")

ResultRatioAlloc DeltaOperating SystemBitProcessor Name
Same0.95+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.94+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.79+0macOS Monterey 12.3Arm64Apple M1 Max
Same0.91+0Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.76+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.93+0Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.91+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Slower0.77+0Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Slower0.82+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.75+0Windows 11X64AMD Ryzen 9 3950X
Slower0.83+0Windows 11X64AMD Ryzen 9 5900X
Slower0.82+0Windows 11X64AMD Ryzen 9 5950X
Same0.91+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.77+0Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Slower0.82+0Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Same0.94+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.03+0ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Slower0.89+0ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.89+0ubuntu 20.04X64AMD Ryzen 9 5900X
Slower0.74+0ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Same0.96+0Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.88+0Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.81+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.95+0macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Same0.94+0macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Same0.94+0macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

Would you consider these regressions as "by design" as there are improvements associated with this PR as noted above.

Yes.

This kind of change will always end up causing some regressions.

@stephentoub

stephentoub commented Aug 11, 2022

Copy link
Copy Markdown
Member

I don't know what the absolute numbers are, but some of these appear to be huge, e. g.

Slower0.17+0Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores

Am I reading that correctly as a 6x regression? S that reproable?

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

I wonder if that was data from @tannergooding

The perf lab doesn't have any x86+amd data. We have x64+amd (not sure which HW version) and shows at best a small regression:

amd x64 windows
newplot - 2022-08-11T082049 388

intel x86 windows -- more "typical" regression ~ 25%

newplot - 2022-08-11T082640 495

@dakersnar

Copy link
Copy Markdown
Contributor

Another regression caused by this from the perf report, this time for System.Collections.IterateForEach<Int32>.HashSet(Size: 512):

Details

System.Collections.IterateForEach.HashSet(Size: 512)

ResultRatioOperating SystemBitProcessor Name
Same0.97Windows 11Arm64Microsoft SQ1 3.0 GHz
Same0.96Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.47macOS Monterey 12.3Arm64Apple M1 Max
Slower0.88Windows 10X64Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.86Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same0.90Windows 10X64Intel Core i7-6700 CPU 3.40GHz (Skylake)
Slower0.89Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Slower0.88Windows 10X64Intel Core i9-10900K CPU 3.70GHz
Same0.97Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.98Windows 11X64AMD Ryzen 9 3950X
Slower0.89Windows 11X64AMD Ryzen 9 5900X
Slower0.87Windows 11X64AMD Ryzen 9 5950X
Slower0.88Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.89Windows 11X64Intel Core i9-10900K CPU 3.70GHz
Slower0.83Windows 11X6411th Gen Intel Core i9-11900H 2.50GHz
Slower0.77ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Same1.02ubuntu 18.04X64Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Slower0.90ubuntu 18.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.89ubuntu 20.04X64AMD Ryzen 9 5900X
Slower0.88ubuntu 20.04X64Intel Core i9-10900K CPU 3.70GHz
Same1.00Windows 10X86Intel Xeon CPU E5-1650 v4 3.60GHz
Same0.99Windows 10X86Intel Core i7-6700 CPU 3.40GHz (Skylake)
Same1.00Windows 11X86AMD Ryzen Threadripper PRO 3945WX 12-Cores
Slower0.84macOS Big Sur 11.6.8X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.84macOS Monterey 12.3.1X64Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower0.85macOS Monterey 12.4X64Intel Core i5-4278U CPU 2.60GHz (Haswell)

@tannergooding

Copy link
Copy Markdown
Member

I wonder if that was data from @tannergooding

Not this time, my two are (both Windows 11 x64):

  • AMD Ryzen 9 5950X
  • 11th Gen Intel Core i9-11900H 2.50GHz

The reporting AMD Ryzen Threadripper PRO 3945WX 12-Cores has some vary wildly differing numbers across many tests. It's not at all what I'd expect particularly given that its just 12-core/24-thread and is effectively a AMD Ryzen 9 3900X but with a higher TDP, more PCI-e lanes, and more memory channels. I'm not aware of any infinity fabric or cache latency issues like the really high core count 2990WX had.

@mrsharm

Copy link
Copy Markdown
Member

I wonder if that was data from @tannergooding

As far as I can tell, this data was supplied by @adamsitnik:

image

Reaching out to try to repro locally.

@adamsitnik

Copy link
Copy Markdown
Member

I've re-run the Regex benchmarks for x86 using the same machine for .NET 6, 7 p5 and 7 p7.

For this particular case ("zdj" + Options.None) the Mean was:

  • 512,958.50 ns for .NET 6
  • 019,770.31 ns for .NET 7 preview 5
  • 059,506.42 ns for .NET 7 preview 7

Compared to .NET 6, Preview 7 is 8 times faster, but compared to Preview 5 it's 3 times slower.

Details
BenchmarkDotNet=v0.13.1.1845-nightly, OS=Windows 11 (10.0.22000.856/21H2)
AMD Ryzen Threadripper PRO 3945WX 12-Cores, 1 CPU, 24 logical and 12 physical cores
.NET SDK=6.0.109
[Host] : .NET 6.0.8 (6.0.822.36306), X86 RyuJIT AVX2
Job-NDWKRI : .NET 6.0.8 (6.0.822.36306), X86 RyuJIT AVX2
MethodPatternOptionsMeanErrorStdDevMedianMinMaxGen 0Allocated
Count(?i)HolmesNone754,052.6 ns8,550.92 ns6,675.99 ns753,024.7 ns744,325.3 ns765,359.4 ns10.416757910 B
Count(?i)HolmesCompiled737,189.9 ns9,014.99 ns8,432.63 ns738,131.5 ns722,725.9 ns751,870.7 ns8.522757910 B
Count(?i)Sher[a-z]+Hol[a-z]+None6,255,396.7 ns38,372.43 ns34,016.16 ns6,253,234.4 ns6,204,706.2 ns6,329,583.3 ns-
Count(?i)Sher[a-z]+Hol[a-z]+Compiled2,296,957.6 ns25,846.78 ns21,583.23 ns2,297,146.4 ns2,266,178.6 ns2,326,673.4 ns10.4167
Count(?i)SherlockNone478,897.3 ns1,470.25 ns1,303.34 ns478,651.5 ns476,986.7 ns481,901.1 ns1.893912649 B
Count(?i)SherlockCompiled509,051.5 ns3,840.10 ns3,592.03 ns508,388.7 ns504,555.8 ns515,516.1 ns2.016112649 B
Count(?i)Sherlock HolmesNone380,587.6 ns6,886.80 ns6,104.96 ns377,577.9 ns374,469.4 ns394,870.4 ns1.602611905 B
Count(?i)Sherlock HolmesCompiled310,444.9 ns6,886.11 ns7,930.06 ns307,458.9 ns300,406.7 ns327,912.0 ns1.225511905 B
Count(?i)SherlockHolmesWatsonNone7,377,067.5 ns123,508.79 ns103,135.43 ns7,352,261.5 ns7,270,724.0 ns7,612,353.1 ns
Count(?i)SherlockHolmesWatsonCompiled2,648,212.9 ns29,553.20 ns27,644.08 ns2,634,536.2 ns2,619,642.5 ns2,713,097.5 ns
Count(?i)Sherlock(...)erJohnBaker [49]None23,259,363.3 ns64,653.02 ns57,313.21 ns23,268,271.4 ns23,102,985.7 ns
Count(?i)Sherlock(...)erJohnBaker [49]Compiled3,625,237.7 ns11,794.66 ns10,455.66 ns3,621,028.1 ns3,611,293.8 ns
Count(?i)theNone2,338,722.2 ns11,413.97 ns10,676.64 ns2,339,698.2 ns2,323,433.9 ns2,359,912.5 ns187.5000990394 B
Count(?i)theCompiled2,075,730.5 ns12,768.46 ns11,318.91 ns2,078,493.3 ns2,048,216.1 ns2,091,713.4 ns187.5000990394 B
Count(?m)^Sherlock(...)rlock Holmes$ [37]None75,058.6 ns195.47 ns173.28 ns74,989.5 ns74,885.1 ns75,461.1 ns0.59814216 B
Count(?m)^Sherlock(...)rlock Holmes$ [37]Compiled47,775.9 ns2,489.12 ns2,663.33 ns46,429.2 ns45,933.4 ns54,122.9 ns0.73964216 B
Count(?s).*None1,424,171.7 ns16,126.38 ns13,466.26 ns1,425,738.8 ns1,407,753.8 ns1,445,335.0 ns-256 B
Count(?s).*Compiled115.3 ns1.06 ns0.88 ns115.1 ns114.0 ns117.1 ns0.0473248 B
Count.*None2,307,370.5 ns14,163.39 ns13,248.44 ns2,303,607.3 ns2,288,772.9 ns2,333,109.4 ns614.58333237027 B
Count.*Compiled1,836,786.3 ns13,906.08 ns12,327.38 ns1,837,340.3 ns1,820,222.9 ns1,863,186.8 ns618.05563237025 B
CountHolmesNone410,846.5 ns697.15 ns582.15 ns410,719.2 ns409,989.5 ns412,097.0 ns9.868457165 B
CountHolmesCompiled542,072.5 ns901.52 ns703.85 ns541,791.7 ns541,294.1 ns543,711.3 ns10.775957166 B
CountHolmes.{0,25}(...).{0,25}Holmes [39]None1,255,836.4 ns23,564.43 ns19,677.36 ns1,247,566.3 ns1,227,308.7 ns1,296,488.9 ns-871 B
CountHolmes.{0,25}(...).{0,25}Holmes [39]Compiled122,396.2 ns2,319.42 ns2,169.58 ns121,956.8 ns120,000.5 ns127,622.1 ns-868 B
CountSher[a-z]+Hol[a-z]+None1,193,239.9 ns13,280.03 ns10,368.17 ns1,190,771.9 ns1,182,279.8 ns1,221,570.7 ns9.6154
CountSher[a-z]+Hol[a-z]+Compiled96,148.9 ns1,884.05 ns1,762.34 ns95,533.7 ns94,249.3 ns100,192.5 ns13.7649
CountSherlockNone255,848.2 ns2,561.47 ns2,138.94 ns255,315.9 ns253,726.9 ns261,010.4 ns2.016112029 B
CountSherlockCompiled385,333.7 ns1,415.14 ns1,254.48 ns385,459.4 ns383,172.2 ns387,239.1 ns1.644712029 B
CountSherlock HolmesNone196,090.3 ns318.44 ns248.61 ns196,151.4 ns195,701.3 ns196,524.5 ns1.562511285 B
CountSherlock HolmesCompiled225,889.7 ns332.66 ns311.17 ns225,936.6 ns225,191.9 ns226,529.5 ns1.811611285 B
CountSherlock\s+HolmesNone252,966.5 ns542.47 ns507.43 ns253,074.7 ns252,337.3 ns253,720.9 ns2.016112029 B
CountSherlock\s+HolmesCompiled383,518.6 ns2,429.83 ns2,272.87 ns382,350.9 ns381,245.1 ns388,755.9 ns1.524412029 B
CountSherlockHolmesNone1,135,940.0 ns2,081.96 ns1,947.47 ns1,135,918.3 ns1,131,050.4 ns1,139,510.7 ns8.9286
CountSherlockHolmesCompiled92,451.5 ns1,497.40 ns1,327.41 ns92,343.8 ns90,716.8 ns94,574.0 ns13.1579
CountSherlockHolmesWatsonNone1,217,614.4 ns3,873.24 ns3,623.03 ns1,215,806.5 ns1,213,037.3 ns1,223,630.0 ns
CountSherlockHolmesWatsonCompiled122,251.8 ns1,088.67 ns1,018.34 ns122,570.3 ns120,466.9 ns124,030.9 ns
CountSherlockHolm(...)erJohnBaker [45]None2,071,894.9 ns15,147.57 ns13,427.93 ns2,067,807.5 ns2,052,608.8 ns
CountSherlockHolm(...)erJohnBaker [45]Compiled628,119.3 ns11,864.50 ns11,098.06 ns625,781.0 ns617,344.5 ns
CountSherlockStreetNone98,758.7 ns783.06 ns694.17 ns98,670.1 ns97,673.5 ns100,041.7 ns3.6526
CountSherlockStreetCompiled56,883.9 ns712.46 ns594.94 ns56,613.9 ns56,296.2 ns58,377.9 ns3.5971
CountTheNone910,171.8 ns15,270.80 ns13,537.17 ns907,817.8 ns895,176.1 ns935,730.1 ns14.705991887 B
CountTheCompiled707,564.1 ns3,349.17 ns3,132.82 ns708,556.8 ns699,982.7 ns712,019.6 ns17.045591886 B
Count[^\n]*None2,241,900.1 ns9,616.83 ns8,995.59 ns2,241,119.8 ns2,224,885.4 ns2,255,783.3 ns614.58333237027 B
Count[^\n]*Compiled1,855,034.0 ns16,799.32 ns15,714.09 ns1,852,061.1 ns1,838,416.7 ns1,892,242.4 ns618.05563237025 B
Count[a-q][^u-z]{13}xNone28,243,473.3 ns72,088.14 ns67,431.29 ns28,236,616.7 ns28,122,733.3 ns28,366,666.7 ns-17715 B
Count[a-q][^u-z]{13}xCompiled6,208,659.2 ns8,894.83 ns8,320.22 ns6,210,318.8 ns6,190,372.9 ns6,222,572.9 ns-17622 B
Count[a-zA-Z]+ingNone27,460,775.8 ns66,660.13 ns55,664.23 ns27,466,628.6 ns27,349,185.7 ns27,553,314.3 ns-350268 B
Count[a-zA-Z]+ingCompiled9,320,517.2 ns35,355.55 ns31,341.78 ns9,328,232.8 ns9,275,456.2 ns9,368,743.8 ns62.5000350198 B
Count\b\w+n\bNone23,642,685.0 ns72,834.84 ns64,566.19 ns23,649,580.0 ns23,476,610.0 ns23,743,930.0 ns100.00001037537 B
Count\b\w+n\bCompiled14,010,602.7 ns66,211.82 ns55,289.87 ns13,987,635.7 ns13,938,128.6 ns14,114,507.1 ns142.85711037430 B
Count\p{Ll}None37,144,155.8 ns143,124.02 ns119,515.04 ns37,176,175.0 ns36,955,900.0 ns37,405,875.0 ns10250.000053689681 B
Count\p{Ll}Compiled24,425,516.2 ns88,646.77 ns82,920.25 ns24,425,357.1 ns24,291,785.7 ns24,565,585.7 ns10142.857153689612 B
Count\p{Lu}None2,314,689.2 ns21,513.23 ns19,070.92 ns2,316,081.2 ns2,288,788.8 ns2,357,571.2 ns325.00001758328 B
Count\p{Lu}Compiled1,354,781.1 ns48,762.06 ns54,198.90 ns1,342,019.3 ns1,289,817.2 ns1,473,167.2 ns333.33331758323 B
Count\p{L}None36,454,935.7 ns178,946.16 ns158,631.11 ns36,434,562.5 ns36,270,300.0 ns36,778,600.0 ns10500.000055448001 B
Count\p{L}Compiled26,320,703.1 ns192,794.87 ns170,907.63 ns26,291,464.3 ns26,047,171.4 ns26,651,957.1 ns10571.428655447932 B
Count\s[a-zA-Z]{0,12}ing\sNone15,334,079.0 ns305,064.63 ns254,742.78 ns15,412,400.0 ns14,502,272.7 ns15,493,509.1 ns-258103 B
Count\s[a-zA-Z]{0,12}ing\sCompiled6,754,800.2 ns5,278.49 ns4,121.10 ns6,755,254.2 ns6,745,866.7 ns6,760,225.0 ns41.6667258058 B
Count\w+None13,970,175.2 ns119,150.43 ns105,623.75 ns13,951,300.0 ns13,845,373.3 ns14,196,253.3 ns2533.333313542579 B
Count\w+Compiled8,120,073.6 ns225,842.98 ns260,081.12 ns8,060,685.9 ns7,830,065.6 ns8,797,225.0 ns2562.500013542556 B
Count\w+\s+HolmesNone11,612,346.2 ns69,034.22 ns64,574.65 ns11,613,693.8 ns11,524,993.8 ns11,735,565.6 ns-39578 B
Count\w+\s+HolmesCompiled3,427,146.6 ns15,167.31 ns14,187.51 ns3,422,823.8 ns3,409,331.2 ns3,458,786.2 ns-39565 B
Count\w+\s+Holmes\s+\w+None12,175,925.4 ns36,424.54 ns32,289.40 ns12,169,659.4 ns12,131,246.9 ns12,240,868.8 ns-17010 B
Count\w+\s+Holmes\s+\w+Compiled3,390,937.9 ns4,190.32 ns3,499.11 ns3,389,681.2 ns3,386,808.8 ns3,398,675.0 ns-16997 B
CountaeiNone653,255.6 ns376.33 ns314.25 ns653,357.6 ns652,639.3 ns653,790.9 ns-2 B
CountaeiCompiled677,740.5 ns6,375.48 ns5,963.63 ns676,190.8 ns667,298.4 ns688,459.0 ns-2 B
CountaqjNone524,937.5 ns1,354.29 ns1,200.54 ns524,932.3 ns523,307.3 ns527,059.4 ns-1 B
CountaqjCompiled873,146.4 ns1,017.16 ns901.69 ns873,112.3 ns871,718.8 ns874,519.4 ns-2 B
CounttheNone1,534,109.3 ns13,902.69 ns13,004.59 ns1,527,801.9 ns1,513,433.8 ns1,556,267.5 ns168.7500895036 B
CounttheCompiled1,541,660.1 ns11,250.23 ns9,394.46 ns1,541,351.9 ns1,525,743.1 ns1,559,265.6 ns168.7500895036 B
Countthe\s+\w+None1,912,813.1 ns12,829.54 ns12,000.76 ns1,910,495.3 ns1,895,882.8 ns1,932,555.5 ns125.0000670845 B
Countthe\s+\w+Compiled1,537,566.9 ns29,616.08 ns27,702.90 ns1,524,593.4 ns1,505,029.7 ns1,584,471.6 ns125.0000670844 B
CountzqjNone512,958.5 ns341.39 ns266.54 ns512,967.7 ns512,380.8 ns513,520.6 ns-1 B
CountzqjCompiled733,671.8 ns5,018.51 ns4,190.68 ns733,996.0 ns728,043.5 ns743,370.5 ns-2 B
BenchmarkDotNet=v0.13.1.1845-nightly, OS=Windows 11 (10.0.22000.856/21H2)
AMD Ryzen Threadripper PRO 3945WX 12-Cores, 1 CPU, 24 logical and 12 physical cores
.NET SDK=7.0.100-preview.5.22276.3
[Host] : .NET 7.0.0 (7.0.22.27203), X86 RyuJIT AVX2
Job-LKHRHJ : .NET 7.0.0 (7.0.22.27203), X86 RyuJIT AVX2
MethodPatternOptionsMeanErrorStdDevMedianMinMaxAllocated
Count(?i)HolmesNone646,946.08 ns3,867.702 ns3,617.851 ns648,069.27 ns641,228.91 ns651,123.96 ns2 B
Count(?i)HolmesCompiled430,208.98 ns1,786.607 ns1,671.193 ns430,141.67 ns427,976.04 ns432,561.98 ns1 B
Count(?i)HolmesNonBacktracking646,694.97 ns1,638.770 ns1,532.906 ns646,206.38 ns644,638.12 ns649,005.38 ns2 B
Count(?i)Sher[a-z]+Hol[a-z]+None4,378,969.93 ns15,075.222 ns14,101.372 ns4,374,923.96 ns4,359,044.79 ns4,401,065.62 ns
Count(?i)Sher[a-z]+Hol[a-z]+Compiled1,041,150.86 ns4,136.001 ns3,666.458 ns1,039,328.54 ns1,036,364.17 ns1,046,628.75 ns
Count(?i)Sher[a-z]+Hol[a-z]+NonBacktracking1,224,805.50 ns5,381.831 ns5,034.168 ns1,223,244.95 ns1,219,868.99 ns1,235,895.43 ns
Count(?i)SherlockNone120,214.83 ns216.163 ns180.506 ns120,146.95 ns120,010.02 ns120,627.10 ns-
Count(?i)SherlockCompiled79,875.57 ns469.463 ns439.136 ns79,969.36 ns79,149.74 ns80,639.38 ns-
Count(?i)SherlockNonBacktracking122,289.22 ns295.570 ns276.477 ns122,299.12 ns121,685.40 ns122,699.56 ns-
Count(?i)Sherlock HolmesNone121,166.54 ns565.185 ns528.674 ns121,055.14 ns120,598.12 ns122,250.72 ns-
Count(?i)Sherlock HolmesCompiled80,108.84 ns984.809 ns873.007 ns79,936.89 ns78,941.53 ns82,063.69 ns-
Count(?i)Sherlock HolmesNonBacktracking122,296.93 ns419.358 ns392.268 ns122,066.26 ns121,933.50 ns122,959.52 ns-
Count(?i)SherlockHolmesWatsonNone7,411,806.25 ns24,898.263 ns23,289.851 ns7,411,034.38 ns7,369,271.88 ns
Count(?i)SherlockHolmesWatsonCompiled1,457,524.92 ns5,292.173 ns4,691.374 ns1,458,263.35 ns1,451,628.98 ns
Count(?i)SherlockHolmesWatsonNonBacktracking2,688,159.23 ns3,197.720 ns2,834.695 ns2,687,523.44 ns2,684,653.12 ns
Count(?i)Sherlock(...)erJohnBaker [49]None25,054,462.50 ns146,748.809 ns137,268.927 ns25,043,925.00 ns
Count(?i)Sherlock(...)erJohnBaker [49]Compiled2,688,395.38 ns6,343.531 ns5,933.742 ns2,686,054.69 ns
Count(?i)Sherlock(...)erJohnBaker [49]NonBacktracking4,004,464.06 ns4,125.406 ns3,657.065 ns4,004,419.35 ns
Count(?i)theNone1,301,173.68 ns2,773.877 ns2,594.687 ns1,299,801.04 ns1,297,869.27 ns1,306,241.15 ns3 B
Count(?i)theCompiled817,298.59 ns1,624.212 ns1,439.822 ns817,223.44 ns813,642.81 ns820,120.31 ns2 B
Count(?i)theNonBacktracking1,427,193.88 ns7,131.521 ns6,670.829 ns1,426,678.69 ns1,417,481.53 ns1,440,190.62 ns4 B
Count(?m)^Sherlock(...)rlock Holmes$ [37]None46,861.94 ns1,474.091 ns1,577.261 ns46,085.94 ns45,315.81 ns50,157.77 ns-
Count(?m)^Sherlock(...)rlock Holmes$ [37]Compiled31,912.70 ns120.225 ns93.864 ns31,878.78 ns31,836.72 ns32,150.60 ns-
Count(?m)^Sherlock(...)rlock Holmes$ [37]NonBacktracking53,825.51 ns46.922 ns41.595 ns53,810.70 ns53,774.48 ns53,910.29 ns-
Count(?s).*None1,291,129.46 ns77,167.437 ns88,866.135 ns1,288,893.47 ns1,180,896.59 ns1,403,653.41 ns4 B
Count(?s).*Compiled62.97 ns0.174 ns0.145 ns62.94 ns62.80 ns63.26 ns-
Count(?s).*NonBacktracking6,820,515.81 ns25,445.756 ns21,248.359 ns6,818,205.56 ns6,785,602.78 ns6,858,294.44 ns18 B
Count.*None1,626,390.62 ns3,235.473 ns2,701.767 ns1,627,285.94 ns1,621,200.78 ns1,630,686.72 ns5 B
Count.*Compiled1,017,730.81 ns4,583.084 ns4,287.020 ns1,018,182.03 ns1,010,559.38 ns1,025,371.48 ns3 B
Count.*NonBacktracking8,664,434.07 ns22,457.024 ns18,752.632 ns8,660,080.95 ns8,642,652.38 ns8,697,076.19 ns31 B
CountHolmesNone63,372.29 ns751.695 ns627.700 ns63,260.33 ns62,736.57 ns64,531.75 ns-
CountHolmesCompiled56,339.37 ns343.970 ns321.750 ns56,153.45 ns56,025.81 ns56,933.71 ns-
CountHolmesNonBacktracking80,862.78 ns398.767 ns373.007 ns80,788.81 ns80,410.90 ns81,488.53 ns-
CountHolmes.{0,25}(...).{0,25}Holmes [39]None343,834.81 ns2,254.715 ns2,109.062 ns343,935.33 ns339,772.55 ns346,704.21 ns1 B
CountHolmes.{0,25}(...).{0,25}Holmes [39]Compiled72,381.25 ns534.150 ns473.510 ns72,323.65 ns71,501.53 ns73,494.23 ns-
CountHolmes.{0,25}(...).{0,25}Holmes [39]NonBacktracking151,278.39 ns888.762 ns831.349 ns151,180.47 ns150,120.67 ns152,781.73 ns-
CountSher[a-z]+Hol[a-z]+None202,882.54 ns736.313 ns614.855 ns202,850.48 ns202,249.60 ns204,378.69 ns
CountSher[a-z]+Hol[a-z]+Compiled79,896.31 ns419.085 ns392.013 ns79,812.76 ns79,393.14 ns80,634.46 ns
CountSher[a-z]+Hol[a-z]+NonBacktracking170,335.81 ns607.677 ns568.422 ns170,330.24 ns169,194.76 ns171,261.16 ns
CountSherlockNone34,512.49 ns126.855 ns112.454 ns34,546.51 ns34,270.96 ns34,690.53 ns-
CountSherlockCompiled40,791.99 ns561.604 ns497.847 ns40,632.91 ns40,267.13 ns41,698.28 ns-
CountSherlockNonBacktracking40,088.45 ns626.785 ns523.394 ns39,883.84 ns39,534.43 ns41,292.63 ns-
CountSherlock HolmesNone35,333.48 ns112.533 ns93.970 ns35,305.33 ns35,218.27 ns35,564.56 ns-
CountSherlock HolmesCompiled41,287.87 ns821.219 ns806.547 ns40,907.35 ns40,453.77 ns42,733.12 ns-
CountSherlock HolmesNonBacktracking43,932.22 ns824.338 ns846.535 ns43,655.57 ns42,931.18 ns45,529.74 ns-
CountSherlock\s+HolmesNone45,760.38 ns234.942 ns208.270 ns45,751.99 ns45,487.17 ns46,167.86 ns-
CountSherlock\s+HolmesCompiled32,567.37 ns489.021 ns433.505 ns32,359.70 ns32,202.59 ns33,452.54 ns-
CountSherlock\s+HolmesNonBacktracking53,985.46 ns1,623.421 ns1,737.042 ns53,600.85 ns52,399.81 ns57,223.62 ns-
CountSherlockHolmesNone192,959.61 ns2,346.615 ns1,832.083 ns192,847.78 ns190,563.05 ns195,515.19 ns
CountSherlockHolmesCompiled75,870.62 ns375.906 ns313.898 ns75,949.54 ns75,414.17 ns76,423.91 ns
CountSherlockHolmesNonBacktracking159,808.71 ns964.267 ns752.836 ns159,993.78 ns158,522.96 ns160,948.34 ns
CountSherlockHolmesWatsonNone297,645.47 ns6,950.681 ns7,137.838 ns295,717.27 ns289,962.84 ns
CountSherlockHolmesWatsonCompiled108,032.71 ns1,524.985 ns1,426.472 ns107,313.87 ns106,452.10 ns
CountSherlockHolmesWatsonNonBacktracking221,386.36 ns10,608.780 ns12,217.087 ns218,307.73 ns206,925.08 ns
CountSherlockHolm(...)erJohnBaker [45]None2,498,383.30 ns106,417.950 ns122,551.069 ns2,494,182.59 ns
CountSherlockHolm(...)erJohnBaker [45]Compiled2,326,725.45 ns50,548.835 ns58,212.113 ns2,320,651.34 ns
CountSherlockHolm(...)erJohnBaker [45]NonBacktracking3,040,149.82 ns111,615.816 ns128,536.940 ns3,044,579.41 ns
CountSherlockStreetNone97,991.29 ns3,479.661 ns3,723.198 ns97,120.77 ns94,660.16 ns107,899.07 ns
CountSherlockStreetCompiled45,965.71 ns2,157.325 ns2,484.379 ns44,934.34 ns43,248.63 ns51,043.13 ns
CountSherlockStreetNonBacktracking71,697.68 ns523.836 ns489.997 ns71,673.09 ns71,011.95 ns72,794.91 ns
CountTheNone80,579.11 ns109.332 ns96.920 ns80,586.57 ns80,451.45 ns80,752.48 ns-
CountTheCompiled69,958.12 ns2,149.200 ns2,475.022 ns69,751.17 ns66,456.68 ns74,210.51 ns-
CountTheNonBacktracking102,790.78 ns1,353.020 ns1,199.417 ns102,611.51 ns101,399.92 ns105,849.72 ns-
Count[^\n]*None1,697,820.39 ns25,593.561 ns23,940.233 ns1,685,109.77 ns1,671,973.83 ns1,750,891.02 ns5 B
Count[^\n]*Compiled1,065,630.76 ns35,084.170 ns38,995.962 ns1,054,713.96 ns1,020,881.88 ns1,155,991.46 ns3 B
Count[^\n]*NonBacktracking8,761,397.14 ns68,787.421 ns64,343.796 ns8,757,475.00 ns8,627,071.43 ns8,860,625.00 ns23 B
Count[a-q][^u-z]{13}xNone60,877.28 ns392.223 ns327.524 ns60,809.64 ns60,342.56 ns61,514.20 ns-
Count[a-q][^u-z]{13}xCompiled37,179.32 ns210.435 ns196.841 ns37,096.70 ns36,973.02 ns37,632.77 ns-
Count[a-q][^u-z]{13}xNonBacktracking77,278.60 ns1,950.748 ns2,246.484 ns76,282.45 ns75,242.79 ns83,176.93 ns-
Count[a-zA-Z]+ingNone13,081,931.47 ns227,989.484 ns202,106.739 ns13,020,460.94 ns12,899,087.50 ns13,579,800.00 ns20 B
Count[a-zA-Z]+ingCompiled4,090,437.01 ns80,753.838 ns79,311.067 ns4,104,550.78 ns3,915,623.44 ns4,248,964.06 ns10 B
Count[a-zA-Z]+ingNonBacktracking6,285,562.88 ns38,411.802 ns29,989.408 ns6,281,562.12 ns6,226,424.24 ns6,334,981.82 ns20 B
Count\b\w+n\bNone26,173,396.43 ns416,161.316 ns368,916.167 ns26,194,090.00 ns25,733,840.00 ns26,933,390.00 ns65 B
Count\b\w+n\bCompiled9,790,192.92 ns183,615.221 ns153,327.025 ns9,758,700.00 ns9,650,908.00 ns10,181,276.00 ns26 B
Count\b\w+n\bNonBacktracking9,180,711.72 ns105,735.091 ns88,293.590 ns9,154,866.67 ns9,113,252.38 ns9,387,990.48 ns31 B
Count\p{Ll}None23,437,684.52 ns160,826.198 ns125,562.517 ns23,426,121.43 ns23,277,628.57 ns23,686,942.86 ns93 B
Count\p{Ll}Compiled13,805,341.43 ns69,150.426 ns61,300.052 ns13,763,286.67 ns13,748,540.00 ns13,910,840.00 ns43 B
Count\p{Ll}NonBacktracking32,941,116.25 ns694,417.120 ns799,691.788 ns32,472,037.50 ns32,211,400.00 ns34,415,950.00 ns163 B
Count\p{Lu}None1,840,413.10 ns31,127.712 ns29,116.881 ns1,840,221.48 ns1,805,855.86 ns1,883,094.92 ns5 B
Count\p{Lu}Compiled1,267,890.59 ns268,226.165 ns308,889.651 ns1,240,147.98 ns940,860.66 ns1,698,140.44 ns2 B
Count\p{Lu}NonBacktracking2,299,865.69 ns19,420.555 ns17,215.816 ns2,301,878.57 ns2,266,858.04 ns2,322,925.89 ns6 B
Count\p{L}None24,461,938.89 ns483,541.832 ns474,902.734 ns24,338,272.22 ns24,020,077.78 ns25,838,922.22 ns72 B
Count\p{L}Compiled14,171,134.69 ns98,394.603 ns87,224.252 ns14,130,964.29 ns14,082,021.43 ns14,365,657.14 ns47 B
Count\p{L}NonBacktracking33,591,002.50 ns1,147,391.032 ns1,321,337.219 ns33,395,912.50 ns32,076,975.00 ns36,342,400.00 ns163 B
Count\s[a-zA-Z]{0,12}ing\sNone15,975,055.38 ns130,410.360 ns121,985.932 ns16,031,753.85 ns15,733,923.08 ns16,125,715.38 ns50 B
Count\s[a-zA-Z]{0,12}ing\sCompiled4,663,690.43 ns89,011.730 ns87,421.421 ns4,635,842.97 ns4,565,529.69 ns4,902,931.25 ns10 B
Count\s[a-zA-Z]{0,12}ing\sNonBacktracking3,653,747.13 ns40,876.681 ns34,133.880 ns3,655,028.57 ns3,610,180.95 ns3,726,588.89 ns10 B
Count\w+None9,320,812.62 ns102,584.938 ns85,663.070 ns9,367,857.81 ns9,120,895.31 ns9,405,673.44 ns20 B
Count\w+Compiled6,072,624.68 ns61,290.833 ns51,180.622 ns6,056,775.00 ns6,018,793.75 ns6,189,152.08 ns14 B
Count\w+NonBacktracking17,113,112.43 ns201,186.443 ns167,999.792 ns17,052,515.38 ns16,860,030.77 ns17,461,915.38 ns50 B
Count\w+\s+HolmesNone9,182,075.22 ns176,080.911 ns156,091.141 ns9,161,896.88 ns9,008,753.12 ns9,576,321.88 ns20 B
Count\w+\s+HolmesCompiled3,765,560.78 ns56,342.471 ns57,859.570 ns3,769,866.67 ns3,690,047.92 ns3,902,016.67 ns14 B
Count\w+\s+HolmesNonBacktracking3,286,613.66 ns33,689.535 ns29,864.895 ns3,281,168.75 ns3,238,023.75 ns3,335,206.25 ns8 B
Count\w+\s+Holmes\s+\w+None9,848,147.20 ns420,111.755 ns466,953.103 ns9,671,090.62 ns9,319,512.50 ns10,859,328.12 ns20 B
Count\w+\s+Holmes\s+\w+Compiled3,740,501.25 ns17,558.187 ns16,423.939 ns3,738,806.25 ns3,709,787.50 ns3,771,356.25 ns14 B
Count\w+\s+Holmes\s+\w+NonBacktracking3,428,630.25 ns121,849.477 ns140,322.039 ns3,388,320.00 ns3,256,893.75 ns3,679,370.00 ns8 B
CountaeiNone49,517.30 ns573.698 ns536.637 ns49,628.68 ns48,729.05 ns50,615.87 ns-
CountaeiCompiled47,077.01 ns2,326.809 ns2,679.557 ns47,065.28 ns42,822.84 ns51,147.65 ns-
CountaeiNonBacktracking43,601.68 ns1,695.002 ns1,951.967 ns43,122.35 ns41,020.60 ns47,268.47 ns-
CountaqjNone27,075.59 ns122.318 ns108.432 ns27,072.68 ns26,883.43 ns27,306.27 ns-
CountaqjCompiled35,466.61 ns111.285 ns104.096 ns35,452.05 ns35,296.95 ns35,670.58 ns-
CountaqjNonBacktracking28,300.61 ns1,104.688 ns1,182.004 ns27,996.04 ns27,059.61 ns31,220.68 ns-
CounttheNone595,360.48 ns2,001.653 ns1,872.347 ns595,607.18 ns591,411.34 ns597,613.19 ns2 B
CounttheCompiled389,823.09 ns1,175.979 ns918.127 ns389,937.80 ns387,896.34 ns390,941.92 ns1 B
CounttheNonBacktracking753,336.19 ns1,178.208 ns1,102.096 ns753,452.98 ns751,694.05 ns754,796.43 ns2 B
Countthe\s+\w+None884,488.08 ns3,496.388 ns3,270.523 ns884,077.08 ns880,477.50 ns890,084.17 ns3 B
Countthe\s+\w+Compiled553,158.59 ns582.333 ns516.223 ns553,278.24 ns552,165.85 ns553,758.04 ns1 B
Countthe\s+\w+NonBacktracking1,381,084.83 ns1,792.035 ns1,676.270 ns1,380,364.38 ns1,378,920.00 ns1,383,577.50 ns4 B
CountzqjNone19,770.31 ns57.805 ns51.242 ns19,769.80 ns19,663.57 ns19,852.86 ns-
CountzqjCompiled19,819.53 ns40.767 ns38.134 ns19,835.13 ns19,751.46 ns19,871.93 ns-
CountzqjNonBacktracking19,776.54 ns44.960 ns42.055 ns19,799.35 ns19,711.39 ns19,822.75 ns-
BenchmarkDotNet=v0.13.1.1845-nightly, OS=Windows 11 (10.0.22000.856/21H2)
AMD Ryzen Threadripper PRO 3945WX 12-Cores, 1 CPU, 24 logical and 12 physical cores
.NET SDK=7.0.100-preview.7.22370.3
[Host] : .NET 7.0.0 (7.0.22.36904), X86 RyuJIT AVX2
Job-USYZGL : .NET 7.0.0 (7.0.22.36904), X86 RyuJIT AVX2
MethodPatternOptionsMeanErrorStdDevMedianMinMaxAllocated
Count(?i)HolmesNone741,321.97 ns2,279.055 ns2,131.829 ns741,051.70 ns737,929.26 ns745,145.17 ns2 B
Count(?i)HolmesCompiled426,563.54 ns3,720.293 ns3,479.965 ns426,531.08 ns421,231.25 ns431,254.22 ns1 B
Count(?i)HolmesNonBacktracking825,943.54 ns1,880.510 ns1,759.030 ns826,249.17 ns822,250.50 ns828,635.31 ns2 B
Count(?i)Sher[a-z]+Hol[a-z]+None4,279,106.94 ns24,429.468 ns22,851.339 ns4,275,406.25 ns4,251,943.75 ns4,324,056.25 ns
Count(?i)Sher[a-z]+Hol[a-z]+Compiled953,636.62 ns2,924.768 ns2,735.829 ns953,916.54 ns949,325.74 ns957,706.99 ns
Count(?i)Sher[a-z]+Hol[a-z]+NonBacktracking1,397,789.50 ns4,109.367 ns3,843.905 ns1,396,670.95 ns1,392,957.54 ns1,404,191.62 ns
Count(?i)SherlockNone131,753.08 ns1,068.638 ns999.605 ns131,378.99 ns130,669.49 ns133,709.35 ns-
Count(?i)SherlockCompiled78,770.19 ns317.231 ns296.738 ns78,759.38 ns78,242.99 ns79,353.12 ns-
Count(?i)SherlockNonBacktracking131,892.38 ns747.601 ns699.306 ns132,122.37 ns130,647.00 ns132,846.37 ns-
Count(?i)Sherlock HolmesNone129,969.60 ns418.149 ns391.137 ns130,086.15 ns129,421.41 ns130,568.96 ns-
Count(?i)Sherlock HolmesCompiled79,172.17 ns520.264 ns461.200 ns79,220.66 ns78,170.45 ns79,785.86 ns-
Count(?i)Sherlock HolmesNonBacktracking130,810.55 ns502.617 ns470.148 ns130,765.02 ns130,209.91 ns131,684.25 ns-
Count(?i)SherlockHolmesWatsonNone6,415,992.92 ns33,353.437 ns31,198.826 ns6,401,908.33 ns6,375,960.42 ns
Count(?i)SherlockHolmesWatsonCompiled1,472,941.86 ns13,827.898 ns12,934.624 ns1,470,821.59 ns1,457,102.27 ns
Count(?i)SherlockHolmesWatsonNonBacktracking2,908,484.59 ns13,909.460 ns12,330.374 ns2,909,225.66 ns2,884,773.68 ns
Count(?i)Sherlock(...)erJohnBaker [49]None21,653,801.79 ns87,626.443 ns77,678.559 ns21,660,962.50 ns
Count(?i)Sherlock(...)erJohnBaker [49]Compiled2,590,903.40 ns9,207.718 ns8,612.905 ns2,587,761.46 ns
Count(?i)Sherlock(...)erJohnBaker [49]NonBacktracking4,504,339.80 ns5,031.831 ns4,460.588 ns4,505,100.00 ns
Count(?i)theNone1,551,821.92 ns1,832.605 ns1,624.557 ns1,551,544.79 ns1,550,020.14 ns1,555,325.69 ns5 B
Count(?i)theCompiled775,506.96 ns818.147 ns765.295 ns775,528.27 ns773,405.06 ns776,426.19 ns2 B
Count(?i)theNonBacktracking1,806,590.27 ns2,552.914 ns2,387.997 ns1,806,682.48 ns1,801,436.50 ns1,811,562.04 ns5 B
Count(?m)^Sherlock(...)rlock Holmes$ [37]None46,989.01 ns225.737 ns211.154 ns47,005.71 ns46,640.33 ns47,258.73 ns-
Count(?m)^Sherlock(...)rlock Holmes$ [37]Compiled41,157.66 ns223.304 ns208.879 ns41,175.61 ns40,853.56 ns41,425.12 ns-
Count(?m)^Sherlock(...)rlock Holmes$ [37]NonBacktracking64,344.20 ns11,361.152 ns13,083.519 ns53,494.51 ns52,559.67 ns79,393.56 ns-
Count(?s).*None1,128,344.34 ns2,627.509 ns2,194.089 ns1,128,822.22 ns1,125,234.03 ns1,132,725.69 ns5 B
Count(?s).*Compiled63.00 ns0.184 ns0.172 ns62.98 ns62.69 ns63.28 ns-
Count(?s).*NonBacktracking4,463,599.62 ns18,065.352 ns16,014.464 ns4,461,514.29 ns4,439,576.79 ns4,491,780.36 ns12 B
Count.*None1,544,370.19 ns5,324.080 ns4,980.147 ns1,545,652.78 ns1,536,868.75 ns1,550,210.42 ns5 B
Count.*Compiled880,479.19 ns4,778.296 ns4,235.835 ns879,598.78 ns874,610.42 ns889,532.64 ns2 B
Count.*NonBacktracking6,730,591.67 ns19,576.168 ns18,311.559 ns6,733,846.88 ns6,695,634.38 ns6,752,771.88 ns20 B
CountHolmesNone85,025.16 ns10,289.669 ns11,849.598 ns84,132.75 ns71,491.15 ns100,281.13 ns-
CountHolmesCompiled58,763.59 ns370.257 ns309.181 ns58,833.72 ns58,164.44 ns59,305.55 ns-
CountHolmesNonBacktracking118,438.18 ns1,843.344 ns1,724.265 ns119,353.90 ns113,845.47 ns119,701.21 ns-
CountHolmes.{0,25}(...).{0,25}Holmes [39]None270,321.58 ns780.023 ns729.634 ns270,428.81 ns268,606.89 ns271,357.52 ns1 B
CountHolmes.{0,25}(...).{0,25}Holmes [39]Compiled70,500.12 ns530.281 ns470.080 ns70,608.14 ns69,691.44 ns71,078.41 ns-
CountHolmes.{0,25}(...).{0,25}Holmes [39]NonBacktracking142,449.76 ns523.469 ns408.690 ns142,658.36 ns141,737.33 ns142,857.53 ns-
CountSher[a-z]+Hol[a-z]+None217,141.51 ns783.807 ns694.824 ns216,976.80 ns216,140.67 ns218,611.04 ns
CountSher[a-z]+Hol[a-z]+Compiled78,780.65 ns420.480 ns393.317 ns78,640.07 ns78,256.82 ns79,438.71 ns
CountSher[a-z]+Hol[a-z]+NonBacktracking176,068.38 ns731.072 ns683.845 ns176,057.44 ns175,064.68 ns177,279.21 ns
CountSherlockNone44,443.82 ns212.009 ns198.314 ns44,488.77 ns43,993.18 ns44,621.46 ns-
CountSherlockCompiled41,524.64 ns793.277 ns662.422 ns41,399.04 ns40,861.47 ns43,563.25 ns-
CountSherlockNonBacktracking69,466.36 ns6,347.151 ns7,309.388 ns74,418.01 ns53,733.55 ns76,643.10 ns-
CountSherlock HolmesNone61,680.07 ns10,077.161 ns11,604.873 ns70,127.94 ns45,430.78 ns71,589.36 ns-
CountSherlock HolmesCompiled41,506.39 ns273.825 ns213.784 ns41,542.18 ns41,098.86 ns41,718.85 ns-
CountSherlock HolmesNonBacktracking51,287.50 ns310.806 ns290.728 ns51,175.61 ns50,839.30 ns51,927.01 ns-
CountSherlock\s+HolmesNone64,831.03 ns9,499.629 ns10,939.787 ns70,929.13 ns48,272.46 ns74,997.46 ns-
CountSherlock\s+HolmesCompiled42,478.63 ns118.535 ns110.877 ns42,468.07 ns42,241.39 ns42,649.62 ns-
CountSherlock\s+HolmesNonBacktracking78,911.53 ns7,413.543 ns8,537.447 ns82,914.42 ns54,058.62 ns84,964.29 ns-
CountSherlockHolmesNone198,358.55 ns447.026 ns418.148 ns198,336.87 ns197,806.17 ns199,298.18 ns
CountSherlockHolmesCompiled75,139.30 ns525.243 ns491.312 ns75,203.41 ns74,314.77 ns76,055.95 ns
CountSherlockHolmesNonBacktracking146,348.85 ns497.559 ns441.073 ns146,263.26 ns145,890.83 ns147,413.96 ns
CountSherlockHolmesWatsonNone283,500.93 ns729.597 ns609.246 ns283,603.41 ns282,352.95 ns
CountSherlockHolmesWatsonCompiled96,065.24 ns281.901 ns249.898 ns96,036.43 ns95,731.82 ns
CountSherlockHolmesWatsonNonBacktracking188,843.53 ns422.868 ns353.114 ns188,717.85 ns188,407.38 ns
CountSherlockHolm(...)erJohnBaker [45]None2,040,253.44 ns126,919.499 ns146,160.684 ns2,033,977.43 ns
CountSherlockHolm(...)erJohnBaker [45]Compiled2,098,517.45 ns8,521.910 ns7,971.400 ns2,096,242.97 ns
CountSherlockHolm(...)erJohnBaker [45]NonBacktracking3,233,434.34 ns10,504.980 ns9,312.392 ns3,236,646.15 ns
CountSherlockStreetNone76,744.42 ns445.326 ns416.558 ns76,708.84 ns76,112.62 ns77,491.10 ns
CountSherlockStreetCompiled37,605.29 ns397.772 ns372.076 ns37,548.20 ns37,051.87 ns38,290.07 ns
CountSherlockStreetNonBacktracking67,275.87 ns310.667 ns290.599 ns67,160.30 ns66,697.08 ns67,804.69 ns
CountTheNone106,844.21 ns10,370.004 ns11,942.112 ns115,062.57 ns86,965.68 ns117,204.52 ns-
CountTheCompiled69,350.34 ns193.595 ns181.089 ns69,389.08 ns69,092.80 ns69,678.48 ns-
CountTheNonBacktracking139,221.51 ns2,782.555 ns3,092.802 ns140,340.42 ns133,371.05 ns142,713.20 ns-
Count[^\n]*None1,645,870.14 ns7,479.366 ns6,996.203 ns1,646,688.19 ns1,636,769.44 ns1,657,963.19 ns5 B
Count[^\n]*Compiled886,535.32 ns5,983.866 ns5,597.312 ns886,417.71 ns879,584.38 ns896,233.33 ns2 B
Count[^\n]*NonBacktracking6,576,847.68 ns28,324.348 ns26,494.612 ns6,581,639.39 ns6,530,966.67 ns6,613,163.64 ns20 B
Count[a-q][^u-z]{13}xNone61,406.99 ns253.170 ns224.428 ns61,438.48 ns60,972.44 ns61,759.99 ns-
Count[a-q][^u-z]{13}xCompiled32,901.34 ns127.085 ns112.658 ns32,886.72 ns32,774.87 ns33,123.13 ns-
Count[a-q][^u-z]{13}xNonBacktracking65,297.14 ns354.743 ns331.827 ns65,333.69 ns64,649.02 ns65,733.51 ns-
Count[a-zA-Z]+ingNone12,612,592.71 ns82,227.728 ns76,915.868 ns12,625,771.88 ns12,496,171.88 ns12,750,781.25 ns20 B
Count[a-zA-Z]+ingCompiled3,739,264.02 ns10,163.774 ns9,009.921 ns3,739,509.38 ns3,723,246.88 ns3,755,883.12 ns8 B
Count[a-zA-Z]+ingNonBacktracking5,051,221.83 ns33,967.913 ns31,773.606 ns5,052,695.00 ns4,998,330.00 ns5,107,302.50 ns16 B
Count\b\w+n\bNone27,807,980.95 ns134,807.991 ns119,503.772 ns27,837,438.89 ns27,494,544.44 ns27,980,122.22 ns72 B
Count\b\w+n\bCompiled9,440,941.67 ns19,744.721 ns15,415.379 ns9,444,880.00 ns9,401,606.67 ns9,455,040.00 ns43 B
Count\b\w+n\bNonBacktracking6,953,168.33 ns45,320.347 ns42,392.681 ns6,961,718.75 ns6,877,478.12 ns7,006,471.88 ns20 B
Count\p{Ll}None28,127,407.86 ns759,823.644 ns875,014.038 ns28,501,192.86 ns26,223,642.86 ns28,737,114.29 ns93 B
Count\p{Ll}Compiled13,321,410.71 ns81,390.662 ns72,150.702 ns13,347,462.50 ns13,167,200.00 ns13,413,100.00 ns41 B
Count\p{Ll}NonBacktracking39,419,346.25 ns801,683.581 ns923,220.004 ns39,830,937.50 ns37,700,000.00 ns40,786,225.00 ns163 B
Count\p{Lu}None2,023,986.48 ns92,251.105 ns106,236.509 ns1,969,701.17 ns1,925,703.12 ns2,231,607.03 ns5 B
Count\p{Lu}Compiled1,315,508.80 ns271,856.433 ns313,070.273 ns1,513,709.05 ns844,541.78 ns1,573,706.25 ns2 B
Count\p{Lu}NonBacktracking2,221,876.11 ns43,444.586 ns44,614.391 ns2,208,992.98 ns2,177,269.30 ns2,331,979.82 ns6 B
Count\p{L}None25,654,160.71 ns68,741.539 ns53,668.872 ns25,669,200.00 ns25,544,957.14 ns25,726,928.57 ns93 B
Count\p{L}Compiled18,014,849.78 ns200,464.710 ns187,514.814 ns18,043,300.00 ns17,415,020.00 ns18,219,566.67 ns43 B
Count\p{L}NonBacktracking38,934,993.33 ns652,844.754 ns610,671.388 ns39,364,225.00 ns38,141,225.00 ns39,496,325.00 ns163 B
Count\s[a-zA-Z]{0,12}ing\sNone12,208,412.18 ns11,155.275 ns8,709.305 ns12,207,561.54 ns12,195,753.85 ns12,223,115.38 ns50 B
Count\s[a-zA-Z]{0,12}ing\sCompiled4,419,674.90 ns17,145.051 ns16,037.491 ns4,421,226.56 ns4,382,335.94 ns4,441,600.00 ns10 B
Count\s[a-zA-Z]{0,12}ing\sNonBacktracking2,796,513.55 ns12,937.848 ns11,469.066 ns2,799,361.54 ns2,775,414.10 ns2,812,706.41 ns8 B
Count\w+None10,636,459.17 ns58,583.876 ns54,799.394 ns10,651,481.25 ns10,556,512.50 ns10,740,368.75 ns20 B
Count\w+Compiled6,328,674.58 ns106,299.649 ns99,432.758 ns6,371,910.42 ns6,168,962.50 ns6,445,389.58 ns14 B
Count\w+NonBacktracking15,494,032.50 ns96,047.840 ns89,843.209 ns15,484,793.75 ns15,338,325.00 ns15,665,362.50 ns41 B
Count\w+\s+HolmesNone9,694,694.27 ns67,672.275 ns63,300.688 ns9,675,701.56 ns9,623,120.31 ns9,848,145.31 ns20 B
Count\w+\s+HolmesCompiled3,615,191.96 ns17,485.753 ns15,500.664 ns3,612,416.67 ns3,595,335.42 ns3,650,470.83 ns14 B
Count\w+\s+HolmesNonBacktracking2,444,741.61 ns13,154.856 ns12,305.060 ns2,445,942.11 ns2,425,164.21 ns2,466,281.05 ns7 B
Count\w+\s+Holmes\s+\w+None9,641,982.08 ns30,395.594 ns28,432.057 ns9,641,915.62 ns9,603,881.25 ns9,689,093.75 ns20 B
Count\w+\s+Holmes\s+\w+Compiled3,619,839.44 ns15,794.409 ns14,774.100 ns3,616,418.75 ns3,600,887.50 ns3,642,425.00 ns14 B
Count\w+\s+Holmes\s+\w+NonBacktracking2,434,820.91 ns10,082.239 ns8,937.642 ns2,436,627.60 ns2,409,888.54 ns2,445,075.00 ns7 B
CountaeiNone75,163.44 ns11,332.904 ns13,050.990 ns82,078.59 ns53,796.44 ns85,911.35 ns-
CountaeiCompiled53,334.08 ns471.858 ns441.377 ns53,447.37 ns52,223.94 ns54,061.25 ns-
CountaeiNonBacktracking52,699.06 ns121.886 ns108.049 ns52,702.46 ns52,425.68 ns52,834.65 ns-
CountaqjNone53,953.03 ns8,966.194 ns10,325.482 ns55,561.38 ns37,174.11 ns65,091.75 ns-
CountaqjCompiled74,327.56 ns34,235.426 ns39,425.567 ns55,996.39 ns36,241.40 ns124,153.28 ns-
CountaqjNonBacktracking45,510.05 ns14,692.055 ns15,720.334 ns36,751.48 ns36,410.73 ns82,800.97 ns-
CounttheNone582,786.16 ns1,148.235 ns1,017.880 ns582,431.25 ns581,885.47 ns584,756.72 ns2 B
CounttheCompiled390,300.33 ns957.133 ns895.303 ns390,229.53 ns388,299.69 ns391,867.97 ns1 B
CounttheNonBacktracking889,485.57 ns11,831.208 ns9,879.595 ns887,103.53 ns875,157.24 ns908,464.31 ns2 B
Countthe\s+\w+None925,506.70 ns3,146.730 ns2,627.662 ns925,341.91 ns919,962.87 ns930,500.00 ns2 B
Countthe\s+\w+Compiled551,541.44 ns3,716.995 ns3,476.880 ns553,286.85 ns546,624.78 ns556,300.22 ns1 B
Countthe\s+\w+NonBacktracking1,233,466.70 ns9,386.297 ns8,320.708 ns1,231,738.97 ns1,222,754.41 ns1,253,408.33 ns3 B
CountzqjNone59,506.42 ns29,040.412 ns33,442.982 ns39,845.82 ns36,619.92 ns122,955.75 ns-
CountzqjCompiled86,479.15 ns34,960.757 ns40,260.859 ns113,196.14 ns38,201.71 ns122,509.62 ns-
CountzqjNonBacktracking93,503.47 ns36,241.934 ns41,736.265 ns125,229.36 ns39,296.77 ns127,768.44 ns-

@stephentoub

stephentoub commented Aug 12, 2022

Copy link
Copy Markdown
Member

this particular case ("zdj" + Options.None)...
Compared to .NET 6, Preview 7 is 8 times faster, but compared to Preview 5 it's 3 times slower.

This regex is going to be heavily dominated by calls to span.IndexOf(string). Would this PR have had material impact on that method's codegen? It's unlikely changes anywhere else in or impacting other areas of regex would show up significantly with this expression. Do benchmarks directly on IndexOf show such a hit between previews 5 and 7?

@mrsharm

Copy link
Copy Markdown
Member

Do benchmarks directly on IndexOf show such a hit between previews 5 and 7?

Seems like the Span.IndexOf(string..) tests haven't regressed between preview 5 and 7. Here's an example for System.Memory.ReadOnlySpan.IndexOfString(input: "AAAAA5AAAA", value: "5", comparisonType: InvariantCulture)

image

Please let me know if you have a specific test you'd like data for.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

How about data for Span.IndexOf(string..) on Adam's box?

@stephentoub

stephentoub commented Aug 13, 2022

Copy link
Copy Markdown
Member

And specifically, a test like this:

privatestring_haystack;privatestring_needle;[GlobalSetup]publicasyncTaskSetup(){usingHttpClienthc=newHttpClient();_haystack=awaithc.GetStringAsync("https://www.gutenberg.org/files/1661/1661-0.txt");_needle="zqj";}[Benchmark]publicintIndexOf()=>_haystack.AsSpan().IndexOf(_needle);

This appears to have regressed significantly for me between .NET 6 and .NET 7 (this is on my Win11 x64); I've not checked if it regressed between Preview 5 and 7 on my machine.

@EgorBo, I know we spoke about this particular case before, but I thought it was mostly addressed. Is this still expected?

MethodRuntimeMeanErrorStdDevMedianRatioRatioSD
IndexOf.NET 6.025.67 us0.508 us0.643 us25.27 us1.000.00
IndexOf.NET 7.039.07 us0.241 us0.226 us39.00 us1.530.04

@EgorBo

Copy link
Copy Markdown
Member

@stephentoub Yeah it's that the worst case for the new algorithm - extremely low density of the first char ('z') - plain indexOf where we align data and only perform a single comparison at once is faster - I'll check again what I can do for it but overall it's expected.

E.g. other inputs for your benchmark:

[Benchmark][Arguments("zqj")][Arguments("tbd")][Arguments("suppressing")]publicintIndexOf(stringneedle)=>_haystack.AsSpan().IndexOf(needle);
| Method | | needle | Mean |
|-------- |------- |------------ |------------:|
| IndexOf | net6.0 | suppressing | 1,103.95 us |
| IndexOf | net7.0 | suppressing | 83.68 us |
| IndexOf | net6.0 | tbd | 1,663.58 us |
| IndexOf | net7.0 | tbd | 123.91 us |
| IndexOf | net6.0 | zqj | 61.75 us |
| IndexOf | net7.0 | zqj | 78.24 us |

@stephentoub

Copy link
Copy Markdown
Member

Thanks. I'm interested in the results on @adamsitnik's box. Your box is showing a 25% regression for that input. My box is showing a 50% regression for that input. And apparently something on Adam's box was resulting in this input being 6x slower for a regex that should basically boil down to that same IndexOf call.

@jozkee

jozkee commented Oct 17, 2022

Copy link
Copy Markdown
Member

The regression for [Last]IndexOf_Word_NotFound* showed-up for .NET 6 vs .NET 7-rc2 report:

Details

System.Globalization.Tests.StringSearch.IndexOf_Word_NotFound(Options: (, IgnoreCase, False))

ResultRatioAlloc DeltaOperating SystemBitProcessor NameModality
Same1.00+0ubuntu 18.04Arm64Unknown processor
Same1.11+0Windows 11Arm64Unknown processor
Same1.10+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same1.10+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.69+0macOS Monterey 12.6Arm64Apple M1
Slower0.71+0macOS Monterey 12.6Arm64Apple M1 Max
Same0.90+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)bimodal
Same0.97+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.97+0Windows 11X64AMD Ryzen 9 5900X
Same1.06+0Windows 11X64AMD Ryzen 9 7950X
Slower0.87+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.68+0debian 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.83+0ubuntu 18.04X64AMD Ryzen 9 5900X
Slower0.71+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.78+0ubuntu 20.04X64AMD Ryzen 9 5900X
Same0.98+0ubuntu 20.04X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Slower0.71+0ubuntu 20.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.79+0macOS Big Sur 11.7X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.80+0macOS Monterey 12.6X64Intel Core i7-4870HQ CPU 2.50GHz (Haswell)

System.Globalization.Tests.StringSearch.IndexOf_Word_NotFound(Options: (en-US, IgnoreCase, False))

ResultRatioAlloc DeltaOperating SystemBitProcessor NameModality
Same1.00+0ubuntu 18.04Arm64Unknown processor
Same1.11+0Windows 11Arm64Unknown processor
Same1.08+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same1.10+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.67+0macOS Monterey 12.6Arm64Apple M1
Slower0.71+0macOS Monterey 12.6Arm64Apple M1 Max
Slower0.88+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same0.97+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.97+0Windows 11X64AMD Ryzen 9 5900X
Same1.07+0Windows 11X64AMD Ryzen 9 7950X
Slower0.87+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.68+0debian 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.83+0ubuntu 18.04X64AMD Ryzen 9 5900X
Slower0.74+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.77+0ubuntu 20.04X64AMD Ryzen 9 5900X
Faster1.23+0ubuntu 20.04X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)several?
Slower0.71+0ubuntu 20.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.80+0macOS Big Sur 11.7X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.78+0macOS Monterey 12.6X64Intel Core i7-4870HQ CPU 2.50GHz (Haswell)

System.Globalization.Tests.StringSearch.LastIndexOf_Word_NotFound(Options: (, IgnoreCase, False))

ResultRatioAlloc DeltaOperating SystemBitProcessor NameModality
Same1.01+0ubuntu 18.04Arm64Unknown processor
Faster1.12+0Windows 11Arm64Unknown processor
Same1.09+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same1.09+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.71+0macOS Monterey 12.6Arm64Apple M1
Slower0.67+0macOS Monterey 12.6Arm64Apple M1 Max
Same0.93+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Same1.01+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.97+0Windows 11X64AMD Ryzen 9 5900X
Same1.07+0Windows 11X64AMD Ryzen 9 7950X
Same0.94+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.67+0debian 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.82+0ubuntu 18.04X64AMD Ryzen 9 5900X
Slower0.81+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.78+0ubuntu 20.04X64AMD Ryzen 9 5900X
Same1.10+0ubuntu 20.04X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Slower0.71+0ubuntu 20.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.85+0macOS Big Sur 11.7X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.84+0macOS Monterey 12.6X64Intel Core i7-4870HQ CPU 2.50GHz (Haswell)

System.Globalization.Tests.StringSearch.LastIndexOf_Word_NotFound(Options: (en-US, IgnoreCase, False))

ResultRatioAlloc DeltaOperating SystemBitProcessor NameModality
Same1.01+0ubuntu 18.04Arm64Unknown processor
Faster1.13+0Windows 11Arm64Unknown processor
Same1.08+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Same1.09+0Windows 11Arm64Microsoft SQ1 3.0 GHz
Slower0.67+0macOS Monterey 12.6Arm64Apple M1
Slower0.68+0macOS Monterey 12.6Arm64Apple M1 Max
Same0.94+0Windows 10X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)bimodal
Same1.00+0Windows 11X64AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same0.96+0Windows 11X64AMD Ryzen 9 5900X
Same1.08+0Windows 11X64AMD Ryzen 9 7950X
Same0.93+0Windows 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.67+0debian 11X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.82+0ubuntu 18.04X64AMD Ryzen 9 5900X
Slower0.80+0ubuntu 18.04X64Intel Xeon CPU E5-1650 v4 3.60GHz
Slower0.78+0ubuntu 20.04X64AMD Ryzen 9 5900X
Faster1.25+0ubuntu 20.04X64Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R)
Slower0.69+0ubuntu 20.04X64Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Slower0.85+0macOS Big Sur 11.7X64Intel Core i5-4278U CPU 2.60GHz (Haswell)
Slower0.85+0macOS Monterey 12.6X64Intel Core i7-4870HQ CPU 2.50GHz (Haswell)

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: PGO-based block reordering interferes with loop recognition

13 participants

@AndyAyersMS@MattGal@epananth@BruceForstall@drieseng@DrewScoggins@mrsharm@stephentoub@dakersnar@tannergooding@adamsitnik@EgorBo@jozkee