Martijn van Oosterhout wrote:
> Anyway, on a Debian Woody machine here I get:
>
>10^6 items, mod = 100
>
>Value (i = index) BSD GLIBC (seconds)
>random() * mod 1.58 2.29
>i % mod 0.52 1.69
>i / (ITEMS / mod) 0.38 1.09
>i ^ 0x5555555 1.18 1.67
>
>It would seem to support the theory that the BSD qsort is faster than the
>Glibc one. The results seem quite repeatable (repeats give +/- 5%).
>
Martin's test on two Linux machines here gives :
10^6 items, mod = 100
1) Mandrake 9 (x86 - Linux 2.4.19, glibc 2.2.5, gcc 3.2)
Value (i = index) BSD GLIBC (seconds)
random() * mod 2.20 2.70
i % mod 0.80 2.10
i / (ITEMS / mod) 0.53 1.28
i ^ 0x5555555 1.64 1.95
2) Yellowdog 2.3 (ppc - Linux 2.4.19, glibc 2.2.5. gcc 2.95.4)
Value (i = index) BSD GLIBC (seconds)
random() * mod 1.74 3.12
i % mod 0.69 2.65
i / (ITEMS / mod) 0.55 1.66
i ^ 0x5555555 1.42 2.45
Interestingly, the the ppc machine gets more improvement from the BSD
qsort than the x86 one does.
regards
Mark