Do everything in Java…

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 22 13:05:21 PST 2014


On Monday, 22 December 2014 at 17:25:48 UTC, deadalnix wrote:
> On Sunday, 21 December 2014 at 10:00:36 UTC, Russel Winder via 
> Digitalmars-d wrote:
>> Although the vast majority of Java is used in a basically I/O 
>> bound
>> context, there is knowledge of and desire to improve Java in a 
>> CPU-
>> bound context. The goal here is to always be as fast as C and 
>> C++ for
>> all CPU-bound codes. A lot of people are already seeing Java 
>> being
>> faster than C and C++, but they have to use primitive types to 
>> achieve
>> this. With the shift to internal iteration and new JITS, the 
>> aim is to
>> achieve even better but using reference types in the code.
>>
>
> That is quite a claim. If it is true in some context, and I'd 
> go as far as to say that vanilla code in C/C++ tend to be 
> slower than the vanilla version in java, ultimately, C and C++ 
> offer more flexibility, which mean that if you are willing to 
> spend the time to optimize, Java won't be as fast. Generally, 
> the killer is memory layout, which allow to fit more in cache, 
> and be faster. Java is addicted to indirections.

If one is willing to spend time (aka money) optimizing, there are 
also a few tricks that are possible in Java and used in high 
frequency trading systems.

Latest as of Java 10, indirections in Java will be a thing of the 
past, assuming all features being discussed make their way into 
the language.

C and C++ are becoming a niche languages in distributed computing 
systems.

--
Paulo




More information about the Digitalmars-d mailing list