Large performance gap between CPU's div instruction and HotSpot's JIT code

前端 未结 1 1272
无人共我
无人共我 2021-02-08 02:01

Since the beginning of CPUs it has been general knowledge that the integer division instruction is expensive. I went to see how bad it is today, on CPUs which have the luxury of

1条回答
  •  不知归路
    2021-02-08 02:38

    As explained by user pvg through the comments, the hypothesized algorithm is indeed in existence and the best one currently known. The algorithm involves division by the same divisor in the preparatory step, so it is fundamentally irreducible as a whole. It is covered in Chapter 10 of the classic publication Hacker's Delight.

    0 讨论(0)
提交回复
热议问题