Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does minifying impact performance of Node.js?

In Browsers minifying and concating or loading asynchronous JavaScript has a positive performance impact. Is this also true for code running in Node.js?

As Example would excessive commenting and using long names for properties of classes that are instantiated often impact performance and memory usage significantly?

like image 785
Kai Avatar asked Aug 04 '12 01:08

Kai


People also ask

Does Minifying JavaScript improve performance?

Minifying strips out all comments, superfluous white space and shortens variable names. It thus reduces download time for your JavaScript files as they are (usually) a lot smaller in filesize. So, yes it does improve performance.

Should you minify Nodejs?

Since node. js runs on the server, I'd say it's meaningless to minify the code.

Does Uglify improve performance?

Uglification improves performance while reducing readability. Encryption: This is the process of translating data, called plain data, into encoded data. This encrypted, or encoded, data is known as ciphertext, and needs a secret key in order to decrypt it.

What makes node JS faster?

The virtual machine can take the source code to compile it into the machine code at runtime. What it means is that all the “hot” functions that get called often than not can be compiled to the machine code thus boosting the execution speed.


1 Answers

Yes, it improves compile-time performance, but compile-time is so insignificant to the overall lifetime of your process that it shouldn't matter. The only difference would be if you're constantly starting and stopping node programs for some weird reason, which if you're doing, is probably wrong.

You won't want to uglify your server-side code, however, because if you get an error back, you'll want to know where in your human-readable code it is to find it and fix it.

I bet the real question is: Do you think the almost insignificant compile-time performance will offset the time it saves to debug your code instead?

The answer to that would be no, just stick with normal human-readable Javascript instead.

like image 192
EhevuTov Avatar answered Sep 21 '22 17:09

EhevuTov