Adobe's C++ Performance Benchmarks is a set of simple C and C++ benchmarks in order to test compiler code generation. While it "C++" in the title, half the tests are in C. The author Chris Cox has also written a blog on C++ performance.
On my Mac (which is gcc 4.0.1), look at these fun things
"int64_t equal constants" 7.36 sec 2175.19 M 0.46
"int64_t notequal constants" 15.97 sec 1001.98 M 1.00
Yeah, "!=" is twice as slow as "==" for this type
Sorting is another fun one:
"qsort array with function pointer" 4.52 sec 4.42 M 1.00
"sort array with standard functor" 1.61 sec 12.41 M 0.36
Which translated says:
qsort( table, tablesize, sizeof(double), less_than_function1 );
is almost 3x slower than
sort( table, table + tablesize );
These are the simple ones, but the goal is to test performance of basic idioms and things you do all the time.
0 comments:
Post a Comment