Skip to content
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

PerfLabTests.LowLevelPerf.StaticDelegate has regressed on Linux x64 #67967

Closed
adamsitnik opened this issue Apr 13, 2022 · 2 comments
Closed

PerfLabTests.LowLevelPerf.StaticDelegate has regressed on Linux x64 #67967

adamsitnik opened this issue Apr 13, 2022 · 2 comments
Labels
arch-x64 area-VM-coreclr os-linux Linux OS (any supported distro) tenet-performance Performance related issue

Comments

@adamsitnik
Copy link
Member

PerfLabTests.LowLevelPerf.StaticDelegate has regressed on Linux x64.

Reporting System:

image

Looking at the commit diff, #65738 seems to be to blame (cc @janvorli).

Repro:

git clone https://github.com/dotnet/performance.git
python3 ./performance/scripts/benchmarks_monthly.py net7.0-preview2 net7.0-preview3 --filter PerfLabTests.LowLevelPerf.StaticDelegate

PerfLabTests.LowLevelPerf.StaticDelegate

Result Base Diff Ratio Operating System Bit Processor Name
Same 723785.36 723696.04 1.00 alpine 3.12 Arm64 Unknown processor
Same 406036.94 406404.81 1.00 debian 11 Arm64 Unknown processor
Same 723245.26 723231.85 1.00 ubuntu 18.04 Arm64 Unknown processor
Slower 234832.09 267772.62 0.88 Windows 10 Arm64 Microsoft SQ1 3.0 GHz
Slower 235887.13 269869.45 0.87 Windows 11 Arm64 Microsoft SQ1 3.0 GHz
Same 205188.98 205032.81 1.00 macOS Monterey 12.3 Arm64 Apple M1 Max
Same 257062.70 246622.22 1.04 Windows 10 X64 Intel Xeon Platinum 8272CL CPU 2.60GHz
Slower 238081.16 264541.67 0.90 Windows 10 X64 Intel Xeon CPU E5-1650 v4 3.60GHz
Same 210286.75 246663.03 0.85 Windows 11 X64 AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same 143409.46 142170.65 1.01 Windows 11 X64 AMD Ryzen 9 5900X
Same 332630.65 350222.08 0.95 Windows 11 X64 Intel Core i5-4300U CPU 1.90GHz (Haswell)
Same 304547.76 319492.63 0.95 Windows 11 X64 Unknown processor
Same 199884.10 199594.98 1.00 Windows 11 X64 Intel Core i7-8700 CPU 3.20GHz (Coffee Lake)
Same 230565.99 233570.36 0.99 Windows 11 X64 Intel Core i9-9900T CPU 2.10GHz
Same 200459.38 217517.14 0.92 alpine 3.13 X64 Intel Core i7-7700 CPU 3.60GHz (Kaby Lake)
Same 380576.28 376321.13 1.01 centos 7 X64 Intel Xeon CPU E5530 2.40GHz
Slower 194035.49 219647.31 0.88 debian 11 X64 Intel Core i7-7700 CPU 3.60GHz (Kaby Lake)
Slower 195775.15 220128.56 0.89 opensuse-leap 15.3 X64 Intel Core i7-7700 CPU 3.60GHz (Kaby Lake)
Slower 241212.25 275027.68 0.88 pop 20.04 X64 Intel Core i7-6600U CPU 2.60GHz (Skylake)
Slower 202248.52 228340.18 0.89 ubuntu 18.04 X64 Intel Xeon CPU E5-1650 v4 3.60GHz
Faster 358265.98 307771.13 1.16 ubuntu 18.04 X64 Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge)
Faster 435897.22 368043.75 1.18 Windows 10 Arm Microsoft SQ1 3.0 GHz
Same 867438.71 867460.14 1.00 ubuntu 18.04 Arm ARMv7 Processor rev 3 (v7l)
Slower 238061.08 264550.78 0.90 Windows 10 X86 Intel Xeon CPU E5-1650 v4 3.60GHz
Same 184812.57 184752.06 1.00 Windows 11 X86 AMD Ryzen Threadripper PRO 3945WX 12-Cores
Same 454396.72 516626.95 0.88 Windows 11 X86 Intel Core i7-10510U CPU 1.80GHz
Same 242192.88 252374.60 0.96 Windows 7 SP1 X86 Intel Core i7-7700 CPU 3.60GHz (Kaby Lake)
Slower 235410.75 264838.38 0.89 macOS Monterey 12.2.1 X64 Intel Core i7-5557U CPU 3.10GHz (Broadwell)
Slower 218997.66 246448.38 0.89 macOS Monterey 12.3.1 X64 Intel Core i7-4870HQ CPU 2.50GHz (Haswell)
@adamsitnik adamsitnik added os-linux Linux OS (any supported distro) tenet-performance Performance related issue arch-x64 area-VM-coreclr labels Apr 13, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 13, 2022
@janvorli
Copy link
Member

I know of this regression. The reason is that the delegate always goes to the target method through a FixupPrecode. With my change, the precode in stable state changed from a direct jump to an indirect jump to the target. I have discussed possible ways to make delegates jump directly to the target method without going through the fixup with David Wrighton and it would require a non-trivial change doing some kind of back patching of the delegates. I am planning to look into it, but the timeframe is not clear yet.

@janvorli janvorli removed the untriaged New issue has not been triaged by the area owner label May 18, 2022
@janvorli
Copy link
Member

I did an experiment to asses the possibility of making delegates call the target method directly. While it improved this benchmark, I haven't seen any perf gain on real world ASPNet benchmarks that uses delegates a lot (the Orchard / Fortunes). Given this and the complexity of the necessary changes it seems it is not worth the effort.
Please note that this benchmark calls the delegate pointing to an empty function, so the effect of my change is very amplified compared to real world scenarios.
So I am closing this as won't fix, @adamsitnik please let me know if you disagree.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-x64 area-VM-coreclr os-linux Linux OS (any supported distro) tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

2 participants