在什么级别的C#编译器或JIT优化应用程序code?编译器、应用程序、级别、JIT

2023-09-02 11:56:38 作者:俄的好你不配拥有*

我想知道这个信息,以减少我的code尺寸的,所以我不会浪费我的时间优化的东西会被编译或JIT来完成。

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.

例如:

如果我们假设编译器内嵌调用属性的get函数,所以我没有保存返回值在一个局部变量,以避免函数调用。

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优化 - (萨沙Goldshtein - $ C $的CProject) JIT优化:内联我(大卫Notario) JIT优化:内联二(大卫Notario)

JIT Optimizations - (Sasha Goldshtein - CodeProject) Jit Optimizations: Inlining I (David Notario) Jit Optimizations: Inlining II (David Notario)

说实话,你不应该过分担心微这样的详细程度。让这个为你的编译器/ JIT'er担心,这是它比您在几乎所有情况下。不要急于选择 premature优化。专注于让你的code工作,那么不用担心以后的优化上,如果(一)不运行速度不够快,(B)你有'大小'的问题。

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.

 
精彩推荐