“The world is built on C++,” says Herb Sutter. For the nearly 30 years since its release it has been the “atom” of the computing world. Numerous applications rely on it: Google Chrome, various Adobe programs, nearly all Windows OS’s and software, Firefox, Thunderbird, MySQL, and more. A recent benchmarking test by Google is just one example of the firm basis the new C++0x standard to build on.
Google recently compared the C++, Java, Go, and Scala languages at the Scala Days 2011 Workshop at Stanford. They used the multi-language-bench code which implements a benchmarking scheme to compare core characteristics of the languages. As the results from their report show, C++ outperformed the other languages in almost every way:
Benchmark Compile Time Factor C++ Dbg 3.9 6.5x C++ Opt 3.0 5.0x Java 3.1 5.2x Java Pro 3.0 5.0x Scala scalac 13.9 23.1x Scala fsc 3.8 6.3x Scala Pro scalac 11.3 18.8x Scala Pro fsc 3.5 5.8x Go 1.2 2.0x Go Pro 0.6 1.0x
Benchmark Binary or Jar [Byte] Factor C++ Dbg 592892 45x C++ Opt 41507 3.1x Java 13215 1.0x Java Pro 21047 1.6x Scala 48183 3.6x Scala Pro 36863 2.8x Go 1249101 94x Go Pro 1212100 92x
Benchmark Time [sec] Factor C++ Dbg 197 8.6x C++ Opt 23 1.0x Java 64-bit 134 5.8x Java 32-bit 290 12.6x Java 32-bit GC* 106 4.6x Java 32-bit SPEC GC 89 3.7x Scala 82 3.6x Scala low-level* 67 2.9x Scala low-level GC* 58 2.5x Go 6g 161 7.0x Go Pro* 126 5.5x
Perhaps the most significant fact is that C++ outperforms the rest in runtime speed. One article rightly states, perhaps, that “benchmarks never tell the full story.” Another article brings up that the code could be optimized for each language to make them more competitive. But, as the report says, the goal was “to provide generic and straightforward implementations of a well specified algorithm, using the default language containers and looping idioms,” which they admit “also led to sub-optimal performance.” In any case, the longstanding history of great performance and support gives the new C++ ISO standard a solid foundation to build on.
The final draft for the new standard, C++0x, was approved on March 25th of this year and is expected to be released this summer. Their committee papers give a detailed look at what changes they are looking to implement. Compilers, such as GCC, have already begun implementing some of the changes.
For more information on the next C++, the list of changes on GCC’s site, perhaps, shows some of the more popular ones, such as alignment support and null pointers. Bjarne Stroustrup at Texas A&M has a great list of questions that he goes through and answers.
Though many other languages are gaining traction, C++ is evolving to keep up. It seems that C++0x will carry this foundational language into the next decade.