Closed performanceautofiler[bot] closed 1 year ago
Seems to be https://github.com/dotnet/runtime/pull/88749 cc @AndyAyersMS
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.
Author: | performanceautofiler[bot] |
---|---|
Assignees: | AndyAyersMS |
Labels: | `os-windows`, `tenet-performance`, `tenet-performance-benchmarks`, `arch-x64`, `area-CodeGen-coreclr`, `untriaged`, `runtime-coreclr`, `PGO`, `needs-area-label` |
Milestone: | - |
IntroSort
is recursive, and we now inline it into itself. Not yet clear why this hurts performance.
PGO data thinks the recursion is pretty frequent:
call site count 75664 callee entry count 78504 scale 0.9638235
That kind of likelihood would normally suggest fairly deep recursion, like 1/(1-0.96...) $\approx$ 30 levels deep, so one level of inlining should cut that depth in half and actually seems plausible. But evidently it has other bad effects. Let me see if I can dig them out.
Seems like we should just block inlining of IntroSort
, there isn't any simplification that can happen with inlining, and despite the apparently high recursion likelihood, the call overhead here is not a dominating factor.
If we block inlining of IntroSort
Method | Job | Toolchain | Size | Mean | Error | StdDev | Median | Min | Max | Ratio | RatioSD | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Array | Job-GINFRD | Pre-89106 | 512 | 4.969 us | 0.5558 us | 0.6177 us | 4.640 us | 4.253 us | 6.081 us | 1.00 | 0.00 | - | NA |
Array | Job-LXATAE | Post-89106 | 512 | 5.224 us | 0.6870 us | 0.7911 us | 4.966 us | 4.235 us | 6.730 us | 1.07 | 0.24 | - | NA |
Array | Job-LWDPQF | Noinline | 512 | 4.667 us | 0.6068 us | 0.6745 us | 4.440 us | 3.856 us | 6.299 us | 0.96 | 0.21 | - | NA |
Note times are highly variable from run to run (per lab data above you can see the inherent ~20% noise level) but based on a number of runs this seems to be a decent option.
Run Information
Regressions in System.Collections.Sort<IntStruct>
📝 - Benchmark Source
Test Report
Repro
General Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md