memcpy performance differences between 32 and 64 bit processes

后端 未结 7 1887
梦如初夏
梦如初夏 2020-12-14 23:43

We have Core2 machines (Dell T5400) with XP64.

We observe that when running 32-bit processes, the performance of memcpy is on the order of 1.2GByte/s; however memcpy

7条回答
  •  天命终不由人
    2020-12-15 00:05

    I don't have a reference in front of me, so I'm not absolutely positive on the timings/instructions, but I can still give the theory. If you're doing a memory move under 32-bit mode, you'll do something like a "rep movsd" which moves a single 32-bit value every clock cycle. Under 64-bit mode, you can do a "rep movsq" which does a single 64-bit move every clock cycle. That instruction is not available to 32-bit code, so you'd be doing 2 x rep movsd (at 1 cycle a piece) for half the execution speed.

    VERY much simplified, ignoring all the memory bandwidth/alignment issues, etc, but this is where it all begins...

提交回复
热议问题