4 ms·
I imagine its probably fairly common. Lots of sites will minify and concatenate their JS, after all.
by bilalq 13y ago
I imagine its probably fairly common. Lots of sites will minify and concatenate their JS, after all.
- geon 13y agoWouldn't that screw up the diff as well?
- borplk 13y agoNot an expert on this, but could something like rsync be implemented and allow it to treat the file as binary? (e.g. minified or non-minified doesn't matter)
- afandian 13y agoIf the minifcation involves symbol substitution, the substitutions are going to depend on the content of the whole file. So unless you re-implement the minification algorithm to be optimised for minimising diffs you might find that every variable's name has changed and size of the file diff might start to approach (or exceed) the size of the file itself.
- michaelmior 13y agoAgreed this is a problem. Although perhaps it's worth not minifying your JS to gain the speedup from the use of diffs?
- pedrocr 13y agorsync requires a lot of communication back and forth which is precisely what you're trying to avoid. You want to fire off a single diff in a single roundtrip.
- wavefunction 13y agoYou don't commit the packaged and minified code to your repo. Instead, you leave it in whatever number of source files you want to use (which are file repo'd). The packaging and minification can be handled either as a filter at the server level or during the build and deploy if your stack supports that metaphor. These have been the common practices in my experience.
- josteink 13y ago> Lots of sites will minify and concatenate their JS, after all. Most with absolutely zero data to back up that it provides any sort of useful improvements to justify the difficulties it introduces in debugging. Considering how almost all web-servers and browsers support HTTP compression, minification is mostly a cargo-cult ritual.
- AlisdairO 13y agoFWIW, I'm making a site at the moment and very similar thoughts entered my head, so I tested it out. Minification + gzip (at best compression level) beat out just gzip by ~ 20%. I don't actually have that much JS so it's not really that important, but just thought it was worth a mention.
- Cthulhu_ 13y agoI never actually gave much thought into whether or not to minify JS or not, thanks for that insight. I'd definitely still concatenate files though; I have one project that has like 150 JS files and another 100 html templates (single page webapp), and there's a very tangible performance difference concatted vs. unconcatted.
- mping 13y agoThis isn't a problem if you generate source maps. Of course, if you have to support and debug old browsers, it's a different story. A quick google search got me to SO: http://stackoverflow.com/a/807161 http://stackoverflow.com/a/807161 results seem pretty significant. Besides, the worse your connection is, the more you will appreciate these techniques.
- byroot 13y agoAs much as I would like your statement to be true: jquery-2.0.3.js 236K jquery-2.0.3.js.gz 70K jquery-2.0.3.min.js 82K jquery-2.0.3.min.js.gz 29K Minification pay off a lot even with compression.
- michaelmior 13y agoTo be fair, this doesn't show a performance improvement, it shows a file size reduction. Of course you can assume one leads to the other, but it doesn't fully prove the point.