-
Notifications
You must be signed in to change notification settings - Fork 5k
Trust single-edge synthetic profile #116054
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
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
@EgorBot -amd -arm using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public class Bench
{
private static Dictionary<string, int> Dictionary =
new()
{
{ "1", 1 },
{ "222", 2 },
{ "3333", 3 },
{ "44444", 4 },
};
[Benchmark]
[Arguments("44444")]
public int Lookup(string key) => Dictionary[key];
} |
Co-authored-by: Copilot <[email protected]>
PTAL @AndyAyersMS @dotnet/jit-contrib @AndyAyersMS I remember you recently made a fix for a similar case, but in your case it was not the root inlinee. E.g. the benchmark ^ is significantly improved as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about doing something lilke this but wondered if it might be a bit too benchmarkish. I had been thinking of modifying the "wrapper method" heuristic but your approach seems simpler and more general, since trust/sufficiency plays out more broadly.
It seems quite possible there is user code written this way where for whatever reason the trivial root method can't be inlined.
This will show an enormous amount of benchmark wins on Windows/Viper when the inlinee is fairly trivial (100's of benchmarks) due to elimination of CET overhead.
Normally, we don't instrument single-edge methods, it means if such a method is an inline root (it happens in Micro-benchmarks as normally single-edge methods are inlined somewhere), all callees don't receive an inlining boost.