News for hackers. Stuff that matters.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by acomjean on Thursday October 10, 2013 @12:29AM (#6525642)
I think generally the libraries in Java help programmers use data structures that make the language seem faster (trees/hashes) . These structures exist in c++ but aren't as easy to use so aren't used as frequently. Those processors extensions will make mathy c++ code significantly faster. When I was on an ada project all the mathy code was written in c/c++ for speed. Pretty amazing the difference.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by cageface on Thursday October 10, 2013 @12:45AM (#6525686)
What? C++ comes with robust trees & hashes via the STL, along with a pretty extensive library of algorithms that work on all the STL containers. And, unlike Java, C++ lets you pack value objects contiguously in memory, which can be a massive performance win due to better cache behavior/no pointer chasing.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by danieldk on Thursday October 10, 2013 @02:16AM (#6525965)
And, unlike Java, C++ lets you pack value objects contiguously in memory, which can be a massive performance win due to better cache behavior/no pointer chasing.

Certainly, and it is one of the features that I am often missing in Java. Rather than having an array of structs, you need to make n parallel arrays, where n is the number of struct fields. And sometimes such hacks are necessary to make things compact and fast.

But I do understand why they don't provide value types. Say, that I am allocating an array of foobar_t. And foobar_t is defined in another library. If the author of the other library changes the layout of foobar_t, you get ABI breakage. This is what brought the whole PIMPL/d-pointer mess that is often necessary in C++ and to some extend C libraries.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by n3rd on Thursday October 10, 2013 @09:26PM (#6531012)
IBM's Java 7 and 8 beta's already have this. It's called Packed Objects and it lets you have have high density data with no pointer chasing along with a much cleaner interface to off-heap languages like C/C++/C# and even languages like Fortran/COBOL etc.

http://www.slideshare.net/mmitran/ibm-java-packed-objects-mm... and http://www.slideshare.net/ZeroTurnaround/ryan-sciampaconerun...

Re:If Java Is Dying, It Sure Looks Awfully Healthy by cageface on Thursday October 10, 2013 @03:01AM (#6526109)
For sure. Mixed value/reference semantics add a lot of complexity to C++.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by pjmlp on Thursday October 10, 2013 @01:48AM (#6525862)
Being discussed for Java 9 and already available on IBM J9 JVM.

http://www.slideshare.net/mmitran/ibm-java-packed-objects-mm...

Re:If Java Is Dying, It Sure Looks Awfully Healthy by swah on Thursday October 10, 2013 @08:57AM (#6527286)
I do miss those in Go.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by judk on Thursday October 10, 2013 @11:07PM (#6531227)
Why can't Java new() use a plank to allocate objects in an array, just like C++ new() can?