On Sun, Nov 24, 2013 at 8:08 PM, Mark Hahn <
ma...@reevuit.com> wrote:
>> Running a 32 bits binary on a 64 bits operating system is certainly
>> possible but system call performance generally takes a hit.
>
> I thought it was the opposite. All 64-bit does is give you more address
> space. 64-bit is slower because the code is larger and fewer instructions
> fit in cache.
It's more nuanced than that. Instructions that deal with immediate
values are larger but position independent code tends to be smaller
and more efficient due to RIP-relative addressing.
There are more registers so data gets spilled to the stack less often.
Ditto for function calls, there's more opportunity to pass arguments
in registers.
The reason why system call performance suffers with 32 bits binaries
on 64 bit hosts, is that every system call goes through a thunk that
switches modes and converts arguments and the return value.