最小化会影响Node.js的性能吗? [英] Does minifying impact performance of Node.js?

查看:94
本文介绍了最小化会影响Node.js的性能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在浏览器中,简化和隐藏或加载异步JavaScript会对性能产生积极影响.在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?

推荐答案

,它可以提高编译时的性能,但是编译时对您的整个进程的生命期来说微不足道,因此不应没关系唯一的区别是,如果您出于某种奇怪的原因而不断地启动和停止节点程序,那么这可能是错误的.

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?

答案是,而是坚持使用普通的人类可读Javascript.

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

这篇关于最小化会影响Node.js的性能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆