是否.NET JIT优化空循环走?NET、JIT

2023-09-03 04:35:48 作者:浅夏﹌非比晴空°

这篇文章表明并非如此。但是,仍然需要评估的循环条件。请问java的只是采用特定的技巧认识到这一点呢?

This article suggests otherwise. But there is still a need to evaluate the loop condition. Does java just employ a specific trick to recognize this case?

推荐答案

查看跟进故事你引用的文章。

请注意,以人回答:它出现在OP是问有关.NET JIT,而不是Java JIT,因为引用的文章指出的Java做的(或只有Java的那样)优化空手循环做得更好

NOTE to people answering: It appears the OP is asking about the .NET JIT, not the Java JIT, since the article referenced suggested that Java did a better job of (or that only Java did) optimizing away empty loops.

编辑:谷歌搜索以获取更多的答案,乔恩斯基特的名字不断上来。参见,例如,在C#优化这个线程。因此,当他的答案,我们将有权威的答案! : - )

Googling for more answers, Jon Skeet's name keeps coming up. See, for example, this thread on C# optimizations. Thus, when he answers, we'll have the authoritative answer! :-)