Hacker News new | ask | show | jobs
by cluckindan 518 days ago
Depends on the performance metrics you care about, and what the application actually does.

JavaScript can be faster in some tasks. Even if JS is 2x slower in another task, it uses 3x less memory than Java.

Which costs more, double CPU time or triple memory requirement?

1 comments

Can you how me some evidence that Java uses 3x the memory? Sure OO heap spam with Java is certainty possible, but the same code written the same way in both languages wont have that much memory difference.
That just notes the max amount of memory used, but not the actual memory it needs. If Java has memory available it makes sense that it uses it instead of spending time cleaning up unused objects.

In addition I have a feeling that these benchmarks are comparing short lived processes. Java does take a bit longer than some other languages to start unless you use native. But that doesn't matter much when you are running long lived services.