Table of Contents
Instruction timings
Here are some results of timings I've done of several instructions in C/C++, to compare several ways to do one thing.
Proceeding
Summary of results
Depending on machines, floating point operations can be a lot slower than integer operations, or as fast, or even faster.
Multiprocessor configs and multicore processors doesn't bring any improvement on these tests, and that's normal. Indeed in order to exploit it you have to have several threads, which is not the case here, and not the purpose.
All results
All timings are given in nanoseconds (ns).
Title | Code | Cyril_F | Cyril_P | cJ_F | MacGyver | Infomob | Almighty | PC104 |
---|---|---|---|---|---|---|---|---|
RGB → Y Conversion | ||||||||
Float | imgg[k2++] = (0.299*img[k++] + 0.587*img[k++] + 0.114*img[k++]); | 175 | 18.8 | 22.1 | 6.09 ??! | 20.8 | 12.6 | 84.3 |
Integer | imgg[k2++] = (19595*img[k++] + 38470*img[k++] + 7471*img[k++]) » 16; | 91.1 | 8.92 | 8.30 | 25.1 | 4.03 | 153 | |
Shift1 | imgg[k2++] = (img[k++]»2 + img[k]»1 + img[k++]»3 + img[k++]»3); | 50.4 | 9.75 | 11.2 | 10.6 | 5.97 | 29.3 | |
Shift2 | imgg[k2++] = (img[k]»2 + img[k++]»4 + img[k]»1 + img[k++]»4 + img[k++]»3); | 56.7 | 12.5 | 13.3 | 11.7 | 6.65 | 43.4 | |
Array indexes | ||||||||
Configs used
Summary
CPU | Frequence | Arith. Coproc. | Bogomips | FPU | Cache | GCC Version | |
---|---|---|---|---|---|---|---|
Cyril_F | Celeron Mendocino | 500 MHz | 1003 | yes | 128 KB | 3. | |
Cyril_P | AMD64 3000+ | 1.8 GHz | 3593 | yes | 1024 KB | 4.1.1 | |
cJ_F | AthlonXP 2400+ | 2.0 GHz | 4013 | yes | 256 KB | 4.1.1 | |
MacGyver | P-m Dothan | 1.7 GHz | 3400 | yes | 2MB | 4.1.1 | |
Infomob | Tri-Xeon | 2.80 GHz | 5570 | yes | 512 KB | 3.2.2 | |
Almighty | PentiumD (DualCore64) | 3.4 GHz | 6800 | yes | 2048 KB | 4.1.1 | |
PC104 | Transmeta Crusoe TM5400 | 500 MHz | 997 | yes | 256 KB | 3.4.6 |