Re:Scala Native v0.1
by therealmarv on Tuesday March 14, 2017 @11:02AM
(#13867996)
But can be important if you only have a 512MB DigitalOcean instance or using small Linux containers/Docker.
[ Parent
| on HN ]
I used the JVM on the 512MB DO instances and containers and they run fine. I think for containers there are other issues (most likely you are going in a micro service-direction where latency is eventually going to be important, so picking another JVM GC-algorithm might be suitable). There may be applications for which the 512 instances and JVM are not suitable, but you can most likely just upgrade the instance.
The JVM itself doesn't add a huge memory footprint. I remember Charles Nutter of JRuby fame calling it the "20-30 MB memory tax" (see http://blog.headius.com/2008/11/noise-cancelling.html).
A lot of the extra memory usage of Java apps comes from sloppy programming and from depending on lots of heavyweight libraries and frameworks.
If you include idiomatic Java programing as part of sloppy programming I also agree with that.
https://www.cs.virginia.edu/kim/publicity/pldi09tutorials/me...
Many things pointed out in this article apply to just about every managed language runtime. Implement a TreeSet in any language and you'll see the same overhead from object headers, memory alignment, etc. Java has some oddities that cause it to waste extra memory, but off the top of my head the only I can think of is 16-bit character Strings. Java 9 is supposed to help with that by allowing Strings to internally store utf8 characters.
I do like the slide though showing that people tend to assemble abstractions together and completely lose sight of the performance costs of what they are doing. There's also the fallacy commonly held by many that because someone took the time to write a framework or library, they must have also taken the time to ensure it's optimized well.
Go uses quite a bit less memory than Java.
As per the Specjbb benchmark, JDK9 compact strings optimization itself provides,
* 21% memory footprint reduction
* 27% less GC
* 5% throughput improvments
https://www.infoq.com/presentations/java-se-9-cloud - check this presentation for more details.Impressive numbers.
Due to value types support, which are part of Java 10's roadmap.