问题描述
我想知道这个信息,以减少我的代码大小,所以我不会浪费我的时间优化的事情将由编译器或JIT。
例如:
如果我们假设编译器内联对属性的get函数的调用,因此我不必将返回值保存在局部变量中,以避免函数调用。 / p>
我想推荐一个描述发生了什么的好参考。
您可以查看这些文章:
老实说,你不应该担心太多的微观细节水平。让编译器/ JIT'er为你担心这一点,它比在几乎所有情况下都更好。不要挂断。专注于让你的代码工作,然后担心以后的优化如果(a)它运行不够快,(b)你有'大小'问题。
I want to know this info to reduce my code size so I will not waste my time optimize things that will be done by compiler or JIT.
for example:
if we assume the compiler inline the call to the get function of a property so I do not have to save the return value in a local variable to avoid function call.
I want to recommend a good reference that describes what is going on?
You may want to take a look at these articles:
JIT Optimizations - (Sasha Goldshtein - CodeProject)
Jit Optimizations: Inlining I (David Notario)
Jit Optimizations: Inlining II (David Notario)
To be honest you shouldn't be worrying too much about this level of micro-detail. Let the compiler/JIT'er worry about this for you, it's better at it than you are in almost all cases. Don't get hung up on Premature Optimisation. Focus on getting your code working, then worry about optimisations later on if (a) it doesn't run fast enough, (b) you have 'size' issues.
这篇关于在什么级别C#编译器或JIT优化应用程序代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!