In a NodeJS application, is there any benefit to using minified source code server-side?
The only benefit I could come up with, is that the smaller JS files would probably be loaded slightly faster from disk. But that seems negligible given that it would only impact startup time.
So, would there be any reason to process our source through uglify or closure compiler before deploying it to our production servers?
The point of minification is reducing bandwith (smaller file = less bytes). Since you're not sending your sever-side code to your client, there's no reason to reduce it. True, reading the file from disk will be a tiny bit faster, but if startup time is your bottleneck, you've got some bigger problems.
Having said that, closure compiler isn't only a minifier: it attempts to be a javascript compiler, trying speed up your code. The different JITs might also like your "compiled" code better, especially in function inlining. Having said that, the speed difference will likely be negligible.
In conclusion: No, but you might enjoy reaping the side-effects. I don't know of any tests, so you could be a pioneer in the field. Benchmark your unminified program over some time, then benchmark the minified version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With