Do short instructions have better performance?

Do I really need to take care of where the .s instructions can be emitted? Or will it only affect size, but will the actual performance be the same?

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

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

+5
source share
1 answer

It depends. The main purpose of .s (and operations with the -containg symbol, for example, ldc.i4.1 ) is to simply reduce the size of the code, and the advantage of reducing the size of the method is to make it possible to embed the method when creating your own code from the CIL of the calling method (The limit for x86 jitter is 32 IL bytes). Therefore, in this case, short instructions can improve application performance if they are used in the built-in candidate method.

Otherwise, since this is not a CIL run, the machine code generated by both short and normal operation codes should be the same (and also optimized when possible) native code.

+1
source

Source: https://habr.com/ru/post/1242171/


All Articles