Herb Sutter’s “Why C++?” Talk Sum-up
This is a sum up of the points I believed to be the most interesting in Herb Sutter’s recent “Why C++?” talk. The video was published on Microsoft’s Channel9, but I have also embedded it here for convenience.
The talk starts with a recap on C++’s history. Then Herb Sutter talks about the rise of “Coffee-based” languages (i.e. managed languages) and how for about a decade (from 1999 to 2009) the industry seemed to accept trumping performance for productivity. Mr. Sutter clearly states he believes this is a perfect valid point, however, he notes that the opposite is also true: trumping productivity for performance is valid (and necessary) in many scenarios. The talk focuses on three such scenarios: Mobile, Datacenter and Desktop.
Managed Languages
Before moving into these scenarios, the talk focuses on the subject of managed languages. Mr. Sutter referenced Windows “Longhorn”, and its attempt to push managed languages as a first class citizen in Operating Systems. He evoked a quote of the time stating that “All new Windows APIs would be managed”.
However, as the OS was being developed, they realized that managed languages didn’t have the performance, deployability or serviceability (among others) required to develop an Operating System. That’s why Windows nowadays is all C and C++ and will probably stay that way.
Furthermore, demanding applications, like vision Apps running on mobile devices and Kinect applications, further emphasize the need for high performance in languages. According to Mr. Sutter, these applications are breathing new life into performance languages, and have been triggering a “C++ Renaissance”.
“Was .NET All a Mistake?” Of course it wasn’t, Mr. Sutter states. “But it can’t do everything C++ can, just like C++ can’t do all .NET can”. Managed languages were the hammer that made everything look like a nail during the last decade. Today, the focus is on high demanding applications that need performance. The “king” is Performance per Watt, per Cycle, per Transistor: Performance per Dollar.
Mr. Sutter takes some time to explain the drawbacks he sees on managed language performance. He quotes several reasons including: Garbage Collection, JIT services, lack or no control on caching and memory layout, etc. Mr. Sutter states that some of these drawbacks can be helped, but that programmers basically have to fight against the language in order to do so.
According to Mr. Sutter, except for the last decade, performance has always been the main reason to pick a programming language, and starting two years ago, it is now again.
Mobile
“Let’s talk about Mobile”. Mobile devices are all about battery, size and bigger experiences on smaller hardware.
Smart Phones are small computers. If we look at the main platforms today: iPhone is programable in Objective-C, C and C++. All native code. Android supports Java, but the Native Development Kit is essential when we need performance.
Mr. Sutter recalls it has not always been this way. The original iPhone preached Javascript development, but for its second version it went all native. Android started preaching Java development, and now supports native development as well. Windows Phone 7 started off with .NET, but by looking at the other two platforms, one can guess what will happen in the near future. The trend is to go all native.
What happens with Web Apps? According to Mr. Sutter they are and will still be there, but will be used as a backup when a native App does not exist for the task. We can look at Google+ for an example. Everyone uses the native App, and “default” to the Web App when there is no native App for the platform being used. Why? Mr. Sutter says it is because of their Performance.
Datacenter and Desktop
What happens in the Datacenter? Citing a study, Mr. Sutter claims that the biggest cost is Hardware and Power. These account for 88% of the total cost of running a Datacenter. Performance/Watt has a direct impact on this, and it can be improved by having more efficient programs.
Mr. Sutter states that if we could reduce Time and Space requirements, we could improve efficiency. Efficiency is “king” for managing the costs of the Datacenter.
Quoting Bjarne Stroustrup: “My biggest contribution to the fight against global warming is C++’s efficiency: Just think if Google had to have twice as many server farms! Each uses as much energy as a small town. And it’s not just a factor of two… Efficiency is not just running fast or running bigger programs, it’s also running using less resources.”
Regarding the Desktop Mr. Sutter notes how being efficient on power and heat also matters in the Desktop. I believe this case is particularly true for laptop devices.
C++11 and the next Decade
Mr. Sutter states: “C++11 is upon us”. Not only does C++11 have a lot of new features, but Mr. Sutter emphasizes how these will be available and also required soon. Programmers will be required to use the new Features in C++11 in order to take advantage of new frameworks (like C++ AMP). “C++ matters again as a first class system”.
The talk concludes by presenting view on what will come after the C++ Renaissance decade (2009-2019). Moore’s law is going to end. It will not happen over night, though, according to Mr. Sutter. The industry will be able to see the end coming when the end of we start obtaining diminishing returns.
Efficiency-oriented languages have a bright future, and they are going to stick around.
To end his presentation, Herb Sutter states that “The answer to the question <<Why C++?>> is <<Why, C++, of course!>>.”