-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Perf] Windows/x64: 1 Regression in IndexOfAny #77906
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
There are other regressions/improvements in the linked issues. |
That PR is adding new methods, not updating existing ones. More likely is #75754, which changes existing IndexOfAny methods. |
Ah sorry, I missed that. |
dotnet/perf-autofiling-issues#9392 is interesting one too: |
It does appear to be #75754 (3e40074) diff --git a/src/benchmarks/micro/libraries/System.Runtime/Perf.String.cs b/src/benchmarks/micro/libraries/System.Runtime/Perf.String.cs
index 4a4646e7..08419463 100644
--- a/src/benchmarks/micro/libraries/System.Runtime/Perf.String.cs
+++ b/src/benchmarks/micro/libraries/System.Runtime/Perf.String.cs
@@ -5,11 +5,14 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
+using BenchmarkDotNet.Diagnostics.Windows.Configs;
using MicroBenchmarks;
namespace System.Tests
{
[BenchmarkCategory(Categories.Runtime, Categories.Libraries)]
+ [InliningDiagnoser(false, true)]
public class Perf_String
{
// the culture-specific methods are tested in Perf_StringCultureSpecific class cd c:\src\runtime\
git worktree add ../runtime-3e40074 3e40074
git worktree add ../runtime-e4471c1 3e40074~
cd ..\runtime-3e40074\
.\build.cmd -c Release
cd ..\runtime-e4471c1\
.\build.cmd -c Release
cd ../
py -3.11 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Tests.Perf_String.IndexOf*' --corerun C:\src\runtime-3e40074\artifacts\bin\testhost\net7.0-windows-Release-x64\shared\Microsoft.NETCore.App\8.0.0\corerun.exe C:\src\runtime-e4471c1\artifacts\bin\testhost\net7.0-windows-Release-x64\shared\Microsoft.NETCore.App\8.0.0\corerun.exe BenchmarkDotNet=v0.13.2.1950-nightly, OS=Windows 11 (10.0.22621.674)
AMD Ryzen 7 5700U with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK=8.0.100-alpha.1.22554.7
[Host] : .NET 8.0.0 (8.0.22.55109), X64 RyuJIT AVX2
Job-DOWZQX : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
Job-YWAYCP : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
PowerPlanMode=00000000-0000-0000-0000-000000000000 IterationTime=250.0000 ms MaxIterationCount=20
MinIterationCount=15 WarmupCount=1
|
Tagging subscribers to this area: @dotnet/area-system-memory Issue DetailsRun Information
Regressions in System.Tests.Perf_String
Reprogit clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net6.0 --filter 'System.Tests.Perf_String*' Related IssuesRegressions
Improvements
PayloadsHistogramEdge Detector InfoSystem.Tests.Perf_String.IndexOfAny
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository
|
The change at https://github.com/Rob-Hague/runtime/tree/indexofany-ros appears to solve the regression. It is not super pretty given the work on deduplication with generics. I did play with generics ala runtime/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs Lines 706 to 716 in e029499
Edit: the tricky bit is that there is no non-value type helpers for 4- and 5- value "between" the 3- value:
and the
so when you have a pattern like this:
the fallback in the private helper after an Wall of benchmarks below. I added "LastIndex.." variants to the benchmark project locally. The comparisons are:
py -3.11 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Tests.Perf_String.*IndexOf*' 'System.Memory.Span<*>.*IndexOfAnyF*' --corerun C:\src\runtime-e4471c1\artifacts\bin\testhost\net7.0-windows-Release-x64\shared\Microsoft.NETCore.App\8.0.0\corerun.exe C:\src\runtime-3e40074\artifacts\bin\testhost\net7.0-windows-Release-x64\shared\Microsoft.NETCore.App\8.0.0\corerun.exe C:\src\runtime\artifacts\bin\testhost\net7.0-windows-Release-x64\shared\Microsoft.NETCore.App\8.0.0\corerun.exe C:\src\indexofany-ros\artifacts\bin\testhost\net7.0-windows-Release-x64\shared\Microsoft.NETCore.App\8.0.0\corerun.exe C:\src\no-inline-attr\artifacts\bin\testhost\net7.0-windows-Release-x64\shared\Microsoft.NETCore.App\8.0.0\corerun.exe
BenchmarkDotNet=v0.13.2.1950-nightly, OS=Windows 11 (10.0.22621.674)
AMD Ryzen 7 5700U with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK=8.0.100-alpha.1.22558.8
[Host] : .NET 8.0.0 (8.0.22.55109), X64 RyuJIT AVX2
Job-WUVVPK : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
Job-UEQUIS : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
Job-BCWCCT : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
Job-ARTMBH : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
Job-TUBRHZ : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
PowerPlanMode=00000000-0000-0000-0000-000000000000 IterationTime=250.0000 ms MaxIterationCount=20
MinIterationCount=15 WarmupCount=1
String:
Byte:
Char:
int:
|
We're currently sitting at 8ns and this is nearly a year old now. I don't think there is really anything actionable for us to do here at this point. |
Run Information
Regressions in System.Tests.Perf_String
Test Report
Repro
Related Issues
Regressions
Improvements
Payloads
Baseline
Compare
Histogram
Edge Detector Info
Collection Data
System.Tests.Perf_String.IndexOfAny
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
The text was updated successfully, but these errors were encountered: