java compiler optimization

前端 未结 5 1348
北荒
北荒 2020-12-11 11:10

Is the Java compiler smart enough to optimize loop below, by extracting the

Double average = new Double( totalTime / callCount ); 

out of t

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-11 11:54

    Not really. The compiler just writes out byte-code. If anything optimized the code, it'd be the Java Virtual machine and that probably depends on the platform, implementation and execution conditions...

提交回复
热议问题