5 ms·
Go definitely does not use "an order of magnitude less memory than Java". That would mean that a Go program that uses 1GB of memory would need 10GB in Java. G
by mdasen 10y ago
Go definitely does not use "an order of magnitude less memory than Java". That would mean that a Go program that uses 1GB of memory would need 10GB in Java.
Google wrote a paper comparing C++, Java, Scala, and Go and definitely did not find that (https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf https://days2011.scala-lang.org/sites/days2011/files/ws3-1-H...).
I like Go and it has many wonderful qualities. Still, it's important to be realistic.
- lossolo 10y agoIn my experience it does use less memory than Java. I had application written in Java which i migrated to Go and i see less memory usage.
- geodel 10y agoWell depending on program. Here is what I see. https://benchmarksgame.alioth.debian.org/u64q/go.html https://benchmarksgame.alioth.debian.org/u64q/go.html
- igouy 10y ago"When there's a big disparity between those Java and [Go] programs, it's mostly the default JVM memory allocation versus whatever [Go] needs." http://programmers.stackexchange.com/questions/189542/is-memory-management-in-programming-becoming-an-irrelevant-concern/189552#189552 http://programmers.stackexchange.com/questions/189542/is-mem...
- geodel 10y agoI looked at this: http://stackoverflow.com/questions/5673388/what-is-the-smallest-you-can-make-a-oracle-jvm-java-heap http://stackoverflow.com/questions/5673388/what-is-the-small... For me using Java 1.8 the number is around 1.5MB. Something similar in Go is 60KB
- richard_todd 10y agoI think for "small-data" programs it does work out to about an order of magnitude of overhead in Java. I have ported several small Java programs to Go and I see it (like 100MB Java vs 8MB Go). One encryption program I coded multiple versions of ran 350k C vs. 1.3MB Go vs. 16MB Java. Programs holding GBs of data in arrays would look much closer, though, I imagine, as the overhead would be dwarfed by the data itself.
- geodel 10y agoPossible. But typically idiomatic Java usage patterns with collection types have huge overheads. So unless Java code is written in specially memory efficient way that memory usage gap should remain https://www.cs.virginia.edu/kim/publicity/pldi09tutorials/memory-efficient-java-tutorial.pdf https://www.cs.virginia.edu/kim/publicity/pldi09tutorials/me...