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

Suggestion: Make a list of JIT optimization supported by RyuJIT #9005

Closed
damageboy opened this issue Sep 24, 2017 · 2 comments
Closed

Suggestion: Make a list of JIT optimization supported by RyuJIT #9005

damageboy opened this issue Sep 24, 2017 · 2 comments

Comments

@damageboy
Copy link
Contributor

From time to time, I learn of "new" (in the sense of not known to me) optimization that RyuJIT or the LegacyJIT can take.

From a recent example, I learned, for instance, that:

For BCL ValueType primitives byte, sbyte, ushort, short, uint, int, ulong, long, IntPtr, UIntPtr, Guid cast via object to the type and use .Equals directly them directly; then rely on the Jit to elide the boxing - meaning the mostly completely inline (e.g. Guid doesn't; though isn't a virtual call)

Or in other words, that in this type of code-construct:

           if (typeof(TKey) == typeof(byte))
            {
                return (byte)(object)key0 == (byte)(object)key1;
            }

The JIT can omit the boxing all together.

As someone attempting to write correct yet readable code, this sort of information, of what the JIT can and can't do, is not available to the best of my knowledge.

Is there a way the a definitive list could be made that describes exactly which optimizations the JIT can make and under what circumstances?

@jkotas
Copy link
Member

jkotas commented Sep 25, 2017

@damageboy
Copy link
Contributor Author

Thanks, I assumed I wasn't the first, but couldn't find anything.. I'll port my comments over there

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants