64-bit executable runs slower than 32-bit version

后端 未结 1 812
别那么骄傲
别那么骄傲 2021-01-23 06:38

I have a 64-bit Ubuntu 13.04 system. I was curious to see how 32-bit applications perform against 64-bit applications on a 64-bit system so I compiled the following C program as

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 07:07

    Comparing performance of code without optimisations is rather pointless. If you care about performance, you'll only ever use optimised code.

    And when you enable optimisations you find that the performance differences are negligible. That is to be expected. The operations you perform are all integer based operations, using data of the same size in all cases. Since the 32 bit and 64 bit code run on the same integer hardware units you should expect the same performance.

    You are not using any floating point operations which is one area where there are sometimes differences between 32 and 64 bit code due to different floating point hardware units (x64 uses SSE, x86 may use x87).

    In short, the results are exactly as expected.

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