This table shows the amount of time taken for various primitive operations on doubles, when compiled on an Intel Core Duo Linux machine at 1.66GHz.
You can also see some speed measurements for matrix multiplication.
Code was compiled with gcc 4.3.1 and options -O2 -funroll-loops. No performance improvement was observed with -O3. Averaged over at least one second of continuous operations.
operation | time | operations per second |
z[i] = x[i] | 1.03ns | 971M |
z[i] += x[i] | 1.30ns | 770M |
z[i] = x[i] + y[i] | 1.38ns | 725M |
z[i] += x[i] + y[i] | 1.49ns | 671M |
z[i] = x[i] * y[i] | 1.50ns | 667M |
z[i] += x[i] * y[i] | 1.86ns | 538M |
z[i] = x[i] / y[i] | 22.4ns | 45M |
z[i] = sqrt(x[i]) | 41ns | 24M |
z[i] = log(x[i]) | 84ns | 12M |
z[i] = exp(x[i]) | 112ns | 8.9M |
z[i] = rand() | 37ns | 27M |