|
|
Benchmarks
DEC 29, 2011 See my latest 2011 Win32/64 C Compiler Benchmarks.
I did my first compiler benchmarks in 2002. Below are some more recent ones that are more limited in scope.
NOV 19, 2011 (There are older 2010 benchmarks below. Scroll down for those.)
Today I benchmarked
MinGW gcc 4.5.2 (32-bit and 64-bit), gcc 4.4.x (32-bit and 64-bit), and
Fabrice Bellard's TCC, an amazingly small compiler that
emphasizes compile speed. All benchmarks were compiled and run on my home PC, a Core i5-670 with
3.7 GHz turbo-boost speed running 64-bit Windows 7 (SP 1). TCC lives up to its claims of
compiling almost 10 times faster than gcc, but, as might be expected, that compile
performance comes with a
significant penalty in executable performance (3 - 4 times slower in these two benchmarks).
For what it is intended to be--a very lightweight, pseudo-scriptable C compiler,
TCC is a remarkable achievement.
Benchmark #1, Image manipulation: crop and re-size 163 images
Lines of code: Approx. 250 K
Compiler |
Compiler Options |
Exe Type |
Compile Time |
Exe Size |
Exe Run Time |
gcc 4.4.0 |
-O3 -ffast-math -m32 |
32-bit |
70.0 s |
2.09 MiB |
105.4 s |
gcc 4.4.5 |
-O3 -ffast-math -m64 |
64-bit |
74.0 s |
2.33 MiB |
78.9 s |
gcc 4.5.2 |
-O3 -ffast-math -m32 |
32-bit |
93.5 s |
2.24 MiB |
105.7 s |
gcc 4.5.2 |
-O3 -ffast-math -m64 |
64-bit |
92.2 s |
2.28 MiB |
76.5 s |
tcc 0.9.25 |
(none) |
32-bit |
10.2 s |
2.22 MiB |
325.1 s |
Benchmark #2, Beam-Wave Interaction Simulator (heavy use of floating point)
Lines of code: Approx. 350 K
Compiler |
Compiler Options |
Exe Type |
Compile Time |
Exe Size |
Exe Run Time |
gcc 4.4.0 |
-O3 -ffast-math -m32 |
32-bit |
99.5 s |
3.54 MiB |
29.0 s |
gcc 4.4.5 |
-O3 -ffast-math -m64 |
64-bit |
102.3 s |
3.98 MiB |
25.3 s |
gcc 4.5.2 |
-O3 -ffast-math -m32 |
32-bit |
127.1 s |
3.79 MiB |
27.6 s |
gcc 4.5.2 |
-O3 -ffast-math -m64 |
64-bit |
126.4 s |
3.95 MiB |
25.8 s |
tcc 0.9.25 |
(none) |
32-bit |
13.0 s |
3.96 MiB |
93.8 s |
FEB 2, 2010
I was able to benchmark some different versions of MinGW gcc with both 32-bit
and 64-bit executables, mostly under Windows 7 64-bit (freshly installed).
I ran a couple of benchmarks. Interestingly, for one benchmark, going from
gcc 3.X to gcc 4.X made a factor of two difference in the speed. For another,
it made almost no difference.
Other notes: both benchmarks are single threaded;
using the -march=native and
-mtune=native (I think -mtune=native is the default) didn't buy much over just
using -O3 -ffast-math; and 64-bit bought about a 15% - 25% improvement over 32-bit.
Benchmark #1, Crop and re-size 200 images
Compiler/Flags |
Compiled on |
Exe Type |
Exe Run Time |
Run on |
gcc 3.4.2 -O3 -ffast-math |
AMD 3200+ |
32-bit |
548 s |
Win XP/AMD 3200+ 2.0 GHz |
gcc 3.4.2 -O3 -ffast-math |
AMD 3200+ |
32-bit |
451 s |
Win 7/Core i5 3.46 GHz |
gcc 4.4.3 (no optimization) |
Core i5 |
64-bit |
420 s |
Win 7/Core i5 3.46 GHz |
gcc 3.4.2 -O3 -ffast-math |
Core i5 |
32-bit |
254 s |
Win 7/Core i5 3.46 GHz |
gcc 4.4.0 -O3 -ffast-math |
Core i5 |
32-bit |
115 s |
Win 7/Core i5 3.46 GHz |
gcc 4.4.3 -O3 -ffast-math |
Core i5 |
64-bit |
90 s |
Win 7/Core i5 3.46 GHz |
gcc 4.4.3 -O3 -ffast-math -march=native -mtune=native |
Core i5 |
64-bit |
90 s |
Win 7/Core i5 3.46 GHz |
Benchmark #2, Beam-Wave Interaction Simulator
Compiler/Flags |
Compiled on |
Exe Type |
Exe Run Time |
Run on |
gcc 3.2 -O3 -ffast-math |
AMD 3200+ |
32-bit |
79 s |
Win XP/AMD 3200+ 2.0 GHz |
gcc 3.2 -O3 -ffast-math |
AMD 3200+ |
32-bit |
40 s |
Win 7/Core i5 3.7 GHz* |
gcc 3.4.2 -O3 -ffast-math |
Core i5 |
32-bit |
28.9 s |
Win 7/Core i5 3.7 GHz* |
gcc 4.4.0 -O3 -ffast-math |
Core i5 |
32-bit |
29.0 s |
Win 7/Core i5 3.7 GHz* |
gcc 4.4.3 -O3 -ffast-math |
Core i5 |
64-bit |
25.8 s |
Win 7/Core i5 3.7 GHz* |
* - 3.7 GHz is clock speed in turbo boost mode.
Benchmark #3, Info-Zip's Zip 3.1/Unzip 6.0
All versions were run on a core-i5 670 with turbo-boost (Windows 7).
Run times were to zip and unzip (-t) 10.4 GB of mostly JPEG files.
Compiler/Flags |
Compiled on |
Exe Type |
Zip Run Time |
Unzip Run Time |
gcc 3.2 -O3 |
AMD 3200+ |
32-bit |
607 s |
110 s |
gcc 3.4.2 -O3 |
Core i5 |
32-bit |
569 s |
111 s |
gcc 4.4.0 -O3 |
Core i5 |
32-bit |
543 s |
109 s |
gcc 4.4.3 -O3 |
Core i5 |
64-bit |
513 s |
110 s |
Benchmark #4, Info-Zip's Zip 3.1/Unzip 6.0 using bzip2 compression
All versions were run on a core-i5 670 with turbo-boost (Windows 7).
Run times were to zip (-Z bzip2) and unzip (-t) 2.3 GB of mostly JPEG files.
(Strange to note the large run time for gcc 4.4.0 32-bit.)
Compiler/Flags |
Compiled on |
Exe Type |
Zip Run Time |
Unzip Run Time |
gcc 3.2 -O3 |
AMD 3200+ |
32-bit |
448 s |
200 s |
gcc 3.4.2 -O3 |
Core i5 |
32-bit |
486 s |
197 s |
gcc 4.4.0 -O3 |
Core i5 |
32-bit |
711 s |
217 s |
gcc 4.4.3 -O3 |
Core i5 |
64-bit |
389 s |
181 s |
|
|
|
|
|