Geeks With Blogs
Timo Heinäpurola

Just recently there was a great talk held by Herb Sutter at the C++ and Beyond conference. You can see the whole presentation at Channel 9.

So why does C++ really matter anymore? All this time we’ve been talking about managed languages (Java, C#, Visual Basic.NET, the list goes on) increasing the productivity of development and being really the holy grail of computing where we don’t have to focus on memory allocation or really knowing anything about the underlying platform, for that matter. All this has recently come to an end when we think about cutting edge applications that will form the basis of the future of computing.

We’re moving more and more into the cloud and building huge data centers, all the while moving our mindset towards mobility. Datacenters have huge compute capacity while mobile devices have to do with very little. Both topics are concerned with power usage, also. Having datacenters use less energy means less money spent on cooling and electricity bills. On the phone this means longer battery life (making the battery of your Android device last over the weekend).

What we have to learn here is that there’s not just a lot of time and money to be saved here, but also focusing on performance means we’re able to build more complicated applications that do even more exciting things (and put them into your pocket too).

Modern processors are built on NUMA architectures, use multiple layers of fast memory caches and run on multiple cores. Not just this, but recent systems are also heavily moving towards heterogeneous computing, which means using thousands of simple cores to perform massively parallelized computations at blazingly high speeds. NUMA and caching, especially, are beasts that will get us into trouble if we’re not careful with where we do things on the chip as well as when we do it.

Managed languages abstract control over memory access as well as the generated code. It’s a step forward that they do JIT compilation but going that extra mile means having the ability to go deeper. Native development is all about that. Allocating memory near to a specific core is easy. Having memory that is used rarely separated from memory that is very hot is also easy. You know where your memory is and you know what the processor is doing and at what point.

Believe it or not, managed languages are not the holy grail. You just can’t optimize resource access when you’re not supposed to care about it. Neither is C++ and native programming a holy grail. It’s often not as productive (this has partially been because of language syntax and libraries, but anyway).

The point: Keep the balance. Do things where you wish to be productive in .NET/Java but when you need performance and/or low power consumption, C++ with it’s wide adoption and object oriented programming style is your choice. Also keep an eye on what’s coming in the new C++ standard, because productivity is just going to get a huge boost.

Posted on Thursday, September 8, 2011 9:22 AM | Back to top

Comments on this post: Why C++ matters?

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © raccoon_tim | Powered by: