DEV Community

Discussion on: 🔥 What's Hot in Web Development? — Weekly Picks #143

Collapse
 
zluther89 profile image
Zach

The go article claims that go
"Consumes more computational resource: Since there’s no virtual machine for this language, the Go files can be far larger than some of the market-leading programming languages. This makes Go consume more RAM."
vs node.

That can't possibly be correct, can it? I'm open to being wrong, but doesn't it's lack of a VM mean it compiles to much smaller code, and isn't Go's memory usage for more efficient than JS? Also V8 isnt really a VM is it?

Collapse
 
idoshamun profile image
Ido Shamun

Yes, I agree with you. Don't know why they mention it.
It should require fewer resources than Node.

Collapse
 
hugosantiagobecerraadan profile image
Hugo S. Becerra Adán • Edited

Go uses AOT compilation and can be used to obtain an executable object file, that when created with static linking produces a large file, just the same way as C/C++ compiles static executables. A static executable file just means that all dependencies are included inside the file, no shared libraries are requires to execute the file. But it does not means it will consume more RAM for that reason.
VMs just execute bytecode, and by nature a VM always consumes more resources than native binary code.
V8 is not a VM but does not produces executable files either. It parses the JS files to obtain a bytecode of the AST that is used in a JIT compiler to create native code and execute it at the moment. V8 take several steps: parsing, analyzing, compiling and executing, and those steps are always going to consume more resources than just executing native code.