3 ms·
Yes. Every object in Java has something like three words of overhead; also since it doesn't have value semantics (yet) objects are typically allocated out-of-l
by CamouflagedKiwi 7y ago
Yes.
Every object in Java has something like three words of overhead; also since it doesn't have value semantics (yet) objects are typically allocated out-of-line, so an ArrayList makes a linear number of allocations, whereas a Go slice makes a constant number.
Plus the binary sizes are typically much smaller; not really an expert but our observataion at work is non-trivial Java services allocate a lot of memory through classloading / JITing whereas a Go binary will typically be very small.
Basically, agreed on the GC tradeoff, but the higher memory footprint of Java mostly comes from other areas.
> Better memory usage always implies worse performance
That isn't really true. Better memory usage implies better cache-friendliness (and possibly better locality too).