One area where D has the edge

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 27 00:05:07 PST 2015


On Tuesday, 27 January 2015 at 06:08:34 UTC, Laeeth Isharc wrote:
>
>
>> There was also this one from 1998 that was very small
>>
>> http://www.javaworld.com/article/2076641/learn-java/an-introduction-to-the-java-ring.html
>>
>> Java has some history running on small devices.
>>
>> Cheers,
>> uri
>
> Indeed, and I remember that well.
>
> However I was less interested in embedded devices and what java 
> could do under conditions of small memory, and more interested 
> in its memory efficiency on servers in managing much larger 
> data sets.  Since it seems to me we are still early in the 
> unfolding of current trends, and what is true today mostly for 
> google and Facebook may be more widely true for others tomorrow.
>
> I do appreciate that java is comparable in execution speed to 
> native code in many cases.  Is its memory footprint really 
> comparable?  And if you have a small team, and not much time, 
> how does that change things - D vs Java?  I don't think for D 
> GC matters so much as not real time and you can easily 
> preallocate buffers.
>
> But don't let me stop you talking about small devices.

I cannot speak about small team experiences. Our projects usually 
take around 30+ developers.

In terms of server applications, yes when the applications are 
deployed usually the memory usage might not be optimal.

However that is why profiling and language knowledge is required.

Fine tuning a Java application is no different than other 
compiled languages, it just requires to know which knobs to turn.

For example, foreach allocates and a simple for does not, so 
choose wisely how to iterate.

If scratch arrays are required multiple times, just allocate it 
once for the complete lifetime of the class.

Always use StringBuilder for string manipulations.

And many other tricks.

The thing that Java still looses in memory management, even in 
commercial JVMs, is lack of value types since escape analysis 
algorithms are not very aggressive, but support is being designed 
and will land partially in Java 9 and Java 10 time frame.

So by Java 10 according to the planned features, there will be 
value types and even the open source JVM will have some form of 
JIT cache. Including the large amount of available libraries.

As for D, it surely has its place and I am looking forward to 
language adoption.

--
Paulo


More information about the Digitalmars-d mailing list