Why is long slower than int in x64 Java?

前端 未结 8 894
野性不改
野性不改 2020-12-04 09:10

I\'m running Windows 8.1 x64 with Java 7 update 45 x64 (no 32 bit Java installed) on a Surface Pro 2 tablet.

The code below takes 1688ms when the type of i is a long

8条回答
  •  借酒劲吻你
    2020-12-04 09:36

    For the records:

    if i use

    boolean decrementAndCheckLong() {
        lo = lo - 1l;
        return lo < -1l;
    }
    

    (changed "l--" to "l = l - 1l") long performance improves by ~50%

提交回复
热议问题