If you are coming back to C++ after a stint with Java, I would highly recommend D. I think it hits the sweetspot between C++ and Java. The not so nice thing about D is that its libraries are not as pervasive and mature. The Phobos and Tango split is currently being addressed. I think all of Tango's functionality will be incorporated into Phobos. With D you get a simpler C++ with optional automatic memory management, and some functional idioms and nice support for parallelism.
@down-voter: If you could explain what you found down-vote worthy that would be nice.
Re:How to get C like performance in Java
by fauigerzigerk on Wednesday July 20, 2011 @06:14PM
(#2787642)
D looks interesting, but I'm a little concerned that the libraries may not be robust or comprehensive enough yet. It's an uphill battle for any new language.
(downvoters are indeed a mystery sometimes)
Re:How to get C like performance in Java
by sliverstorm on Wednesday July 20, 2011 @04:04PM
(#2787179)
So what you're saying is, if you want C-like performance in Java, switch to C?
Re:How to get C like performance in Java
by fauigerzigerk on Wednesday July 20, 2011 @04:08PM
(#2787201)
Exactly, because otherwise you get assembler-like productivity. Specifying memory layouts in Java is much more low level than C or C++ programming.
If you truly need C-like performance in Java, use C++.
Re:How to get C like performance in Java
by peter_lawrey on Thursday July 21, 2011 @04:23AM
(#2788854)
I would say I am less concerned about how memory is packed, than how much is discarded. This is because memory is relatively cheap these days. A machine with 24 GB of memory costs around £1K.
However you make a good point that C++ gives you better control over how memory is arranged and you have to use hacks like the Unsafe class in Java (which is not as friendly)
At the end of the day, going down that road makes you less productive than working in C++ and the result will still be subpar compared to a C or C++ solution. So I'm back with C++ right now even though I'm painfully aware of its weaknesses.