Benchmarks

To compare the speed of all Linux computers I get my fingers on, I use a simple program to calculate n! (n<120000). The program was compiled with gcc, optimization enabled (-O2). Here are the results:

x86 25000! 50000! 100000!
i386 33 MHz 421s 1847s 8321s
i486 33 MHz 276s 1201s 5317s
i486DX2 66 MHz 143s 625s 2730s
PENTIUM 60 MHz 70s 302s 1357s
PENTIUM 100 MHz 43s 186s 819s
PENTIUM 133 MHz 32s 141s 630s
K6-2 333 MHZ 9s 38s
Duron 1000 MHz 2s 13s
Atom Z530 2.2s 9.5s 42s
XP@166*9 2s 5s 26s
Atom CPU Z3736F 1.2s 4.9s 19.4s
A64-3000+, SLAMD64 1s 4s 15s
A64-X2 3800, sflack 1s 3s 14s
Celeron N4100 0.55s 2.42s 10.43s
Celeron N4120 0.50s 2.17s 9.40s
Pentium B970 0.45s 1.91s 8.25s
Core i5-2400 0s 2s 6s
Pentium G3420 0.3s 1.02s 4.24s
Pentium G4500 0.23s 0.90s 3.98s
RISC 25000! 50000! 100000!
SPARC 2 358s
SPARC 10 146s 633s 2738s
SPARC 20 116s 508s 2210s
ULTRA SPARC 167MHz 46s 206s 897s
Dreambox 250MHz -O3 19s 86s 374s
N800 330MHz -O3 17s 83s 352s
RPi 800MHz -O3 7s 37s 183s
ingenic Xburst 1.2GHz -O3 4s 19s 84s
Xburst -O3 -mips32r2 3.8s 17.2s 75.4s
RPi 2 900MHz -O2=O3 4.4s 16.4s 66.4s
RK3066 ??1.3GHz -O3 2s 12s 54s
RK3188 1.6GHz -O2=03 2s 9s 40s
Orange Pi PC 1.3GHz 1.8s 7.5s 32.0s
Orange Pi PC2 1.3GHz 1.6s 7.0s 30.0s
POWER5 1.65GHz -O3 1s 5s 21s
RPi 4 0.78s 3.0s 13.2s
/*********************************************************************/
unsigned int f[200000];
#include <stdio.h>
#include <sys/time.h>

void compute(n,f) unsigned int n, *f;
{unsigned int i=1,j,k,l,m=1; f[1]=1; 
 for (j=2; j<=n; j++) 
   {l=0; for (k=m; k<=i; k++) 
      {l=j*f[k]+l; f[k]=l&0x7FFF; l=l>>15;} 
    if (l) {f[++i]=l&0x7FFF; 
        if (l>>15) f[++i]=l>>15;} 
    if (!f[m]) m++;} 
 *f=i;}

void print_result(n,f) unsigned int n, *f;
{unsigned int i=*f,j,k,l=0,m=(i-1)%4+15; 
 while(i) {j=0; for (k=0;k<4;k++) {j=(j<<1)+((f[i]>>m)&1);if(!m--){m=14;i--;}} 
 if (!(l&0x3F)) putchar('\n'); putchar(j<10?j+'0':j-10+'A'); l++;} 
 printf("\n\n%d! has %d hex digits\n",n,l);}

int main()    /* int must be >= 4 byte */
{ unsigned int i, n; struct timeval t1,t2; 
 do {
   printf("calculate n! (n<=120000) n=? ");
   i=  scanf("%d",&n);
 } while (n>120000 );
 gettimeofday(&t1, 0); compute(n,f); gettimeofday(&t2, 0);
/*print_result(n,f);*/ 
printf("time = %d ms\n",(int)(t2.tv_sec*1000+t2.tv_usec/1000-t1.tv_sec*1000-t1.tv_usec/1000));} 

/*********************************************************************/
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License