# Yet another 64-bit vs. 32-bit comparison benchmark

## devsk

Recently, I was pretty bugged by the amd64's intermittent freezes during IO operations. The problem is described in the thread:

https://forums.gentoo.org/viewtopic-t-482731-highlight-.html

I went ahead and created an equivalent 32-bit install with the same kernel source and .config to rule out x86_64 as the culprit for freezes. And the intermittent freezes during IO went away with x86. I then went ahead made some performance comparisons. All the test were done three times to rule out the caching effect. Here is the result:

```

%age is calculated using (b-a)*100/a, where b > a

        X86             AMD64

Boot time: (x86 faster by ~24%)

        42s             52s

# time eupdatedb [best/worst]: (amd64 better by 5%, amd64 was long when cache wasn't warm)

        21/35           20/63

mencode with x264  and 2 threads fps (amd64 better by 15%)

        16.06           18.39

# time ./amd64-create using squashfs (amd64 better by about 94%)

        348/351         179/192

# time bonnie++ -d ./bonnie/ -s 4100 -n 2 (about the same)

Version 1.93c       ------Sequential Output------ --Sequential Input- --Random-

Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--

Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP

x86           4100M   243  98 124612  57 52277  15   726  97 125497  16 459.1   7

amd64         4100M   315  99 121766  56 51868  12  1395  95 125700  14 501.4   8

real    3m5.935s

real    3m0.818s

# cd /usr/src

# time tar czpf linux-2.6.21-gentoo-r1-mpt-offR4.tar.gz linux-2.6.21-gentoo-r1-mpt-offR4/ (amd64 better by 11%)

        16.630s         15.014s

# cd /usr/src/linux

# time make -j3 (amd64 is better by 5%)

        323s            307s

# time emerge --metadata (amd64 better by 10%)

        12.663s         11.519s

```

Overall amd64 wins most benchmarks but the problem described in the other thread makes it hard to use some of the times, particularly when there is lot of IO going on.

I still have both the installs. So, if someone want some info or tests to be done, let me know.Last edited by devsk on Fri Jun 15, 2007 12:39 pm; edited 1 time in total

----------

## no_hope

 *devsk wrote:*   

> 
> 
> ```
> 
> Boot time: (x86 faster by ~24%)
> ...

 

I recently switched to 64 bits on both my desktop and laptop and it sure feels like both boot faster now. No hard numbers to back it up though.

Could you run "dd if=/dev/your_hd of=/dev/null" for about a minute and then ctrl-c (it will print stats then)

And could you run:

time python -c "import random, math ; l = [random.random() for i in xrange(10000000)] ; ll = map(math.exp, l);"

time python -c "import math ; l = [i + i for i in xrange(10000000)];"

----------

## devsk

 *no_hope wrote:*   

>  *devsk wrote:*   
> 
> ```
> 
> Boot time: (x86 faster by ~24%)
> ...

 that can't happen because not only the disk image of the programs is larger for 64-bit but the memory footprint is larger as well (a pointer is 8 byte on 64-bit). Programs load faster in 32-bit without a doubt.

----------

## devsk

ok, no_hope, there is hope... :Wink:  I got the tests you asked for, and then some.

```

time python -c "import random, math ; l = [random.random() for i in xrange(10000000)] ; ll = map(math.exp, l);" (amd64 better by 27%)

        11.2/12.1s              8.8/9.4s

        9.4/10.3s(-O3) {16%}

        11.6/12.3s(-Os)

time python -c "import math ; l = [i + i for i in xrange(10000000)];" (amd64 better by 15%)

        4.4s            3.8s

        4.1s(-O3) {15%}

        4.7s(-Os)

time dd if=/dev/mapper/nvidia_abcdijf of=/dev/null (x86 better by 5%)

        130 MB/s        124 MB/s

```

Notice, how O3 compiled python works better. But -O3 in general is slow down for many other packages from what I have observed. For example:

```

# cd /usr/src

# time tar czpf linux-2.6.21-gentoo-r1-mpt-offR4.tar.gz linux-2.6.21-gentoo-r1-mpt-offR4/ (amd64 better by 11%)

        16.630s (-O2 for tar and gzip)

        21.345s (-O3 for tar and gzip)
```

----------

## no_hope

Thanks very much for the tests!

 *devsk wrote:*   

> 
> 
> ```
> 
> time python -c "import random, math ; l = [random.random() for i in xrange(10000000)] ; ll = map(math.exp, l);" (amd64 better by 27%)
> ...

 

This is very impressive! Kind of makes up a little for absence of the psyco module for 64bit systems.

 *devsk wrote:*   

> Notice, how O3 compiled python works better. But -O3 in general is slow down for many other packages from what I have observed.

 

Is there a way to specify gcc optimization on per-package basis? Latest versions of sqlite apparently also get significant performance improvements with -O3

----------

## devsk

 *no_hope wrote:*   

> Thanks very much for the tests!
> 
>  *devsk wrote:*   
> 
> ```
> ...

 yes. create /etc/portage/env/<pkg_cat>/<pkg_name_withoutversion>. for example,

```
mkdir -p /etc/portage/env/dev-lang

cd /etc/portage/env/dev-lang

ln -s ../O3-cflags python

```

file /etc/portage/env/O3-cflags contains 'CFLAGS=<blah>' in one line and 'CXXFLAGS=<blah>' in next.

----------

## no_hope

 *devsk wrote:*   

> yes. create etc/portage/env/<pkg_cat>/<pkg_name_withoutversion>. for example,
> 
> ```
> mkdir -p /etc/portage/env/dev-lang
> 
> ...

 

Is this documented somewhere?

----------

## devsk

 *no_hope wrote:*   

>  *devsk wrote:*   yes. create etc/portage/env/<pkg_cat>/<pkg_name_withoutversion>. for example,
> 
> ```
> mkdir -p /etc/portage/env/dev-lang
> 
> ...

 I don't know honestly.

----------

## mudrii

 *no_hope wrote:*   

>  *devsk wrote:*   yes. create etc/portage/env/<pkg_cat>/<pkg_name_withoutversion>. for example,
> 
> ```
> mkdir -p /etc/portage/env/dev-lang
> 
> ...

 

Check this links for more nfo

http://www.mail-archive.com/gentoo-user@lists.gentoo.org/msg54130.html

https://forums.gentoo.org/viewtopic-t-499881-postdays-0-postorder-asc-start-0.html

----------

## tnt

could you write some of your hardware configuration: cpu/chipset/ram/drives?

----------

## devsk

 *tnt wrote:*   

> could you write some of your hardware configuration: cpu/chipset/ram/drives?

 who is this question for, and why?

----------

## tnt

 *devsk wrote:*   

>  *tnt wrote:*   could you write some of your hardware configuration: cpu/chipset/ram/drives? who is this question for, and why?

 

well, for you: it's not the same performance difference between x86 and amd64 modes on athlon64/net-burst/core2 architecture.

----------

## devsk

 :Laughing:   ok.

amd 3800 X2, NVIDIA NForce4, 2GB PC3200. I think its a fair comparison between x86 and x86_64 because the underlying hardware is same for both.

----------

## tnt

 *devsk wrote:*   

>   ok.
> 
> amd 3800 X2, NVIDIA NForce4, 2GB PC3200. I think its a fair comparison between x86 and x86_64 because the underlying hardware is same for both.

 

yes, its fair comparison, but I've read that Intel's net-burst architecture benefits less from 64bit mode. something like its not so 64bit-meant-to-be, but reather additionally implemeted with 64bit instructions. don't know about core2 architecture exactly...

that's why I've been asking about hardware.

----------

