-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Make private & internal stuff sealed #2915
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
base: main
Are you sure you want to change the base?
Conversation
There's a part of the discussion missing here perhaps - what is the motivation for this? Sure, we can do it and it doesn't change the API, but: is there something specific we're doing it for? Note that none of this seems to be likely to be areas where the JIT will care to do anything different for |
It results in less IL, as the virtual dispatch is no longer needed, and makes the functions candidates for inlining: The exception is .NET Framework, where it has no effect. I admit that I have not done any performance analysis of this, but the motivation is correctness and presumed that any performance gains would be welcome, albeit probably hardly measurable. |
One more thing, it removes the Branch predictors are very good, but by removing the |
I'm very aware of the potential advantages of devirtualization; however, whether such things are useful is hugely contextual. Yes, there are some tight loop CPU bound scenarios that might be meaningful in hot code paths, but unless I'm very mistaken, none of that is remotely relevant to any of the situations presented. When suggested arbitrarily without concrete applicable reasons, this ... just seems ... cargo cult programming. I don't mean to be dismissive or disparaging - but I'm also not a fan of changes without demonstrable reasons. |
I think the comprehensional cost of adding the If just a single virtual dispatch can be avoided for a call to redis, it is worth it, to avoid polluting the branch predictors & caches with unneeded stuff. |
# Conflicts: # src/StackExchange.Redis/ResultProcessor.cs
That's not how anything works.
The IL is identical; it emits the same Note also that the JIT can often sees through I guess it comes back down to:
The conversation so far has focused on "optimal"; this change will have zero effect on that (or so close to zero that it is negligible). That means we're left with the implicit unstated reason (one of):
These are probably presumably more honest. To quote Phil Davis (White Christmas):
I do think it is important to be clear about why we're proposing / making any change, and the impact we expect it to have. |
No description provided.