Quick Java Optimization Question

后端 未结 3 469
南旧
南旧 2021-01-05 00:00

Will the Eclipse compiler automatically convert multiplication by a power of two into a bit shift, or should I do that manually? Thanks for the help.

3条回答
  •  忘掉有多难
    2021-01-05 00:51

    Don't second guess a modern java compiler unless you know exactly what you are doing. This not only applies to simple math like you question, but everything. E.g.: like flow control.

    People waaaaay smarter than us have put lots of effort into making it all super fast.

提交回复
热议问题