Why javac does not optimize even simple code?

后端 未结 2 883
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-18 00:41

Given the following code:

public class MainClass {
    public static int f(){
        int i=0;
        i++;
        return i;
    }
}

the c

2条回答
  •  渐次进展
    2021-01-18 01:34

    Also, by moving optimization to JVM, all JVM based languages can benefit. Compilers (not just javac) have a relatively easier job; language inventors don't have to be optimization experts.

提交回复
热议问题