开发者

Should I minify javascript in userscripts for Greasemonkey or Chrome extensions?

Is it worthwhile to minify a script that goes into an extension or userscript for Greasemonkey? I ask because the user will just be downloading it once and ru开发者_Python百科nning it many times (it's not part of the webpage). Assume that it's about 50k uncompressed.

Will it save time for the user? Is it significant or is most of the gain in the download speed?


Minifying javascript is only interesting for increasing the download speed. The execution of the javascript will not be faster.


Do not minify your code. This helps others to understand it -- which is important because many people will not use a script unless they can be reasonably sure that it's not doing bad things.

Also, decent code makes it easier for users to help you debug problems and for other users to modify it to taste (We've all started on the backs of programmers that came before).

As the others stated, any speed/performance gains will be too small to measure.


It will reduce the download time, but most likely only slightly, and the user won't notice it. A webpage usually minifies js to save bandwidth and loading times, but in your case none of these are relevant.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜