On Wed Apr 25 15:17:15 EDT 2012, strake...@gmail.com wrote:
> On 25/04/2012, erik quanstrom <quans...@quanstro.net> wrote:
> > i think you mean the maximum value of an integer
> > rather than a count.  assuming this, vlongs are
> > still 64 bits with 8c and the 32-bit architecture.
> >
> > what's wrong with them?
> 
> Twice as many instructions, if I'm not mistaken, and a waste of good
> 64-bit registers.

it's not like the registers are real on a modern x86 machine in any mode
after renaming, etc.  and this is also offset somewhat by the fact that
pointers are now twice as big.

so best case for 64-bit, is that you are adding 64-bit numbers in a tight
loop with almost no memory access.  i get only a 2-3x speedup for this
case

32-bit machine (not idle):
        minooka; time 8.addv
        3.08u 0.00s 3.11r        8.addv  # status= main
        minooka; aux/cpuid -i
        Intel(R) Xeon(R) CPU           E5540  @ 2.53GHz

64-bit machine (idle, but slower)
        bonanza; time 6.addv
        1.55u 0.00s 1.58r        6.addv  # status= main
        bonanza; aux/cpuid -i
        Intel(R) Xeon(R) CPU           E5504  @ 2.00GHz

by amdahl's law, you're going to have to be doing a hell of a lot of
vlong arithmetic to make this pay.

also, in case you missed it sizeof(int)==sizeof(long)==4 on both 32
and 64 bit plan 9, so recompiled programs won't get bigger integers
just for the recompiling.

- erik

-----
bonanza; cat addv.c
#include <u.h>
#include <libc.h>

void
main(void)
{
        int i;
        vlong acc;

        acc = 0;
        for(i = 0; i < 1000000000; i++)
                acc += i;
}

Reply via email to