3 ms·
Node is much simpler to work with, and if you're running one shot, short serverless ops (i.e. not batch), faster to start (no JVM cold start) and cheaper to run
by SillyUsername 4y ago
Node is much simpler to work with, and if you're running one shot, short serverless ops (i.e. not batch), faster to start (no JVM cold start) and cheaper to run (less RAM) than Java.
If they're really concerned about performance they'd not go wrong by using Deno which often has at least double the performance of Node https://medium.com/deno-the-complete-reference/node-js-vs-deno-vs-bun-server-side-rendering-performance-comparison-f80a5abc766f https://medium.com/deno-the-complete-reference/node-js-vs-de...
Deno for a lot of operations is actually comparable to Java level performance: https://programming-language-benchmarks.vercel.app/java-vs-typescript https://programming-language-benchmarks.vercel.app/java-vs-t...
- fidgewidge 4y agoOf course there is cold start. Both Node and Deno use JIT compilation just like regular Java, which means they warm up. JS code will use more RAM than Java for equivalent constructs, not less. You may be fooled though, by the way that the JVM by default will use free RAM rather than burn energy/CPU collecting garbage when it doesn't need to. So it will look like your app is using a lot of RAM but in reality the JVM will give it up when asked.
- SillyUsername 4y agoMy experience of paying for cloud services does not back that up. Java AWS Lambdas are typically 2-3x heavier in memory usage than a TS/JS equivalent, and the benefit of that warmup is negated if the Lambda shuts down due to idle time. "Give it up when asked" !== less streamlined, it means expanding heap is required for normal operation. Too little heap, it buckles, GC is almost constant, and performance goes out of the window.
- fidgewidge 4y agoThat's inherent to any GC algorithm. More CPU time = less RAM usage because garbage is collected more aggressively. I don't understand why you think that JS, a JIT compiled GC'd language, doesn't warm up and doesn't have to trade off GC time vs memory.
- cutler 4y agoBun is supposed to be even faster.