Just sounds like a mis-use of Java. Java is slower than C++, but it's a fairly small difference, ie. between 1x and 3x the speed. So if the cpp code did the work in a second, the Java version should have taken at most 3 seconds.
The real reason for the difference is that the rewrite into C++ used all of the domain knowledge he had acquired in writing the Java version. If he has made a Ruby version next, it would likely have been similarly efficient (maybe 5 secs? Who knows).
It's a key problem in these kind of anecdotes: a rewrite will nearly always be more efficient as it has more knowledge to work with during the architecture phase of the project.
From what i know the code was quite simple and even trivial, using existing java libraries as much as possible. The fact is that using corresponding cpp libraries let him get what he needed with much less fuss. I do not know why the java version was so inefficient and used all memory,it might be due to one ofnthe librariez, but this is illustrating an example where cpp was relevant , which was the point of my comment.
And if he now rewrote the code in Scala using even better domain knowledge and it ran in 0.1 seconds, would this be proof to you that C++ isn't relevant after all?
The point of my comment is that your basis is flawed. The apples to chimpanzees reasoning you are using is not valid.
I think you missed the point there was no domain knowledge advantage in the second version.
If you run out of memory you're just not doing it right. C++ uses less memory than Java, this is true. But if using the same algorithm in C++ with a larger database, generating a bigger PDF perhaps, you will still fail. Could also be that just increasing the managed heap will help, but I guess this is a case about keeping to much in memory.
Switching to C++ solved his problem; if tools don't exist to solve problems, what, indeed, are they for?
The code was trivial, using common libraries for the language. I wanted to show a situation where a c++ web framework was useful.
I understand the intent. However, out of memory exceptions usually mean wrongful use of libraries, or poor quality of said libraries. It doesn't make C++ more or less usefull than Java for a particular task, as the exact same code in C++ would lead to the same result, altough it would take longer for C++ to get there.
We agree. The fact is that the java libs blew, and not the cpp libs. Making the decision to develop the solution in cpp the right one, contradicting the top comment of this thread.
No we still disagree. A poor library, or poor use of said library, is not a reason to use an entirely diffrent language. It's a reason to use a diffrent library or fix your code.
Also, did you see wt is widget oriented and has a java version, which you can use with jruby if you want?