Version française
Home     About     Download     Resources     Contact us    
Browse thread
32- and 64-bit performance
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: 32- and 64-bit performance

I just bought a new Athlon 64 laptop and installed 32- and 64-bit Debian.
Here are some timings, showing the performance change when moving from 32-
to 64-bit using ocamlopt (3.08.2) and g++ (3.4.4):

Sieve primes up to 10^8 (bit-twiddling/array limited):

32-bit OCaml: 7.102s
64-bit OCaml: 5.697s
Ratio: 1.25

32-bit C++: 19.145s
64-bit C++: 13.433s
Ratio: 1.43

100th-nearest neighbours from a 10k-atom model of amorphous silicon
(de/allocation limited):

32-bit OCaml: 28.407s
64-bit OCaml: 35.538s
Ratio: 0.80

32-bit C++: 14.035s
64-bit C++: 12.392s
Ratio: 1.13

Generate, bubble sort and accumulate an array of 10^4 double-precision
random floating-point numbers:

32-bit OCaml: 1.185s
64-bit OCaml: 0.785s
Ratio: 1.51

32-bit C++: 1.471s
64-bit C++: 0.957s
Ratio: 1.54

without bounds checking:

32-bit OCaml: 0.992s
64-bit OCaml: 0.591s
Ratio: 1.68

32-bit C++: 1.249s
64-bit C++: 0.705s
Ratio: 1.77

2048^2 mandelbrot (float-arithmetic limited):

32-bit OCaml: 2.946s
64-bit OCaml: 1.704s
Ratio: 1.73

32-bit C++: 1.479s
64-bit C++: 1.161s
Ratio: 1.27

1024 FFTs and iFFTs (float-arithmetic limited):

32-bit OCaml: 31.491s
64-bit OCaml: 9.260s
Ratio: 3.40

32-bit C++: 8.441s
64-bit C++: 8.562s
Ratio: 0.99

Accumulate a Lorentzian over the number of integer triples (i, j, k) which
lie in i^2 + j^2 + k^2 < 400 (float-arithmetic limited):

32-bit OCaml: 16.329s
64-bit OCaml: 9.459s
Ratio: 1.73

32-bit C++: 8.002s
64-bit C++: 5.933s
Ratio: 1.35

So ocamlopt does seem to generate significantly better code in these examples, 
particularly when they are floating point intensive. Also, only one test is 
slower in 64-bit, due to its heavy use of trees.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists