DEV Community

Discussion on: Why Go for Node.js Developers

Collapse
 
sammyisa profile image
Sammy Israwi • Edited

On my Laptop the JavaScript process uses 8.6MB while the Go one uses 380KB

Quick question, how can you tell how much memory each process uses? And why do you think Node uses so much more memory in this case?

Collapse
 
jorinvo profile image
jorin • Edited

Easiest way to see the resource usage of a process is to open Activity Monitor on Mac or Task Manager on Windows.

The memory usage of Node.js is surprising low if you think about how much the environment is doing for you. The runtime translates your code to actual machine code on the fly and while your program is running, it is still being analyzed and optimized so that hot code paths become more efficient and so on.
Everything you have with a compiled language like Go in the separate build step, the VM in a language like JavaScript is doing for you at runtime.

Hope this helps a bit. If you are interested there are many interesting talks and articles about the internals of JavaScript (and other) engines, for example this one: youtube.com/watch?v=p-iiEDtpy6I