Is C++ still needed?
gerd-riesselmann.net
gerd-riesselmann.net
There might be a case to be made to eliminate C++, but it's best made by somebody who knows more than this guy.
This is really a terrible submission.
http://shootout.alioth.debian.org/u32q/benchmark.php?test=al...
http://shootout.alioth.debian.org/u32q/benchmark.php?test=al...
The lessons to draw from this, if any, are that C++ code isn't automatically faster than Java or C# code: you have to make it so; and that Java/C# have some useful high-quality libraries which save you the need to roll your own solution.
Do applications in C++ get modeled the same way as they would in Java or C#? Allocation speed doesn't quite seem like an apples to apples comparison.
For example: Creating a temporary file and after some work deleting it would be done using try & finally sections in idiomatic Java, but in C++ an object would be used where the constructor contains the file creation and the destructor contains the deletion. This way the file lifetime is tied strictly to the object lifetime, which would be destroyed automatically when the code block is left.
However, the fact that object allocation on the heap is slow is mitigated by having the ability to create objects on the stack, which is probably even faster than Java or C#. And they are also managed automatically, so stack objects are always preferred if they are suitable.
While I think it is an apple-to-apple comparison, it is a microbenchmark, and as such probably irrelevant in most of the real-world cases.
Also note that C++'s memory model is "single threaded" new must grab a global lock where as C#'s memory allocator is designed with threads in mind so no locking overhead.
Isn't that the case for any programing language?
Anyway, just a curiosity :)
But if my team have to build such app with cross-platform requirement, I still think C++ would be the choice. [with the similar arguments the author uses at the end of his rant]
Obviously the author has not heard of boost::python -- it provides an extremely easy way to interface Python and C++, including classes in one language that inherit from classes in the other.
EDIT: Oh, yeah, and SWIG.