FrameworkBenchmarks icon indicating copy to clipboard operation
FrameworkBenchmarks copied to clipboard

[C#][aspnetcore] - mark all classes sealed

Open unsafePtr opened this issue 2 years ago • 0 comments

That's a tiny improvement which might help for runtime to devirtualize class.

I would better quote Stephen Toub from this topic.

If the runtime can see that a given instance on which a virtual call is being made is actually sealed, then it knows for certain what the actual target of the call will be, and it can invoke that target directly rather than doing a virtual dispatch operation. Better yet, once the call is devirtualized, it might be inlineable, and then if it’s inlined, all the previously discussed benefits around optimizing the caller+callee combined kick in.

unsafePtr avatar Jun 08 '22 20:06 unsafePtr