开发者

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

开发者 https://www.devze.com 2023-03-16 08:08 出处:网络
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

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

精彩评论

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

关注公众号