Do short instructions have better performance?

Do I really need to care where it's possible to emit .s instructions? Or will it only affect the size but the real performance will be the same?

The generated dll is going to be used also on AOT platforms. Will the resulting AOT-ed dll be the same for IL with .s and without?

I mean br.s, ldloca.s, etc..

Answers


It depends. The main purpose of .s (and literal-containg opcodes like ldc.i4.1) are just to decrease the size of the code, and the advantage of decreasing the size of a method is to make it possible to inline the method when generating native code from CIL of the calling method (the limit for x86 jitter is 32 bytes of IL). So in this case, short instructions can increase the performance of the application, if they are used in a inline-candidate method.

Otherwise, as it is not the CIL that's executed, the machine code generated by both of short and normal opcodes should be the same (and also optimized, when possible) native code.


Need Your Help

Google MapActivity not displaying map

android google-maps keytool

I am trying to get google maps working. It is not displaying the map. I get the following error in LogCat

Modify multidimensional arrays in PHP5

php arrays multidimensional-array

I have a multidimensional array that i would like to go through, and add a new key and value to it called "depth" that holds an integer 0 and up. first level would be 0, a child array would hold 1,...