FWIW, 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.
To 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.
time curl http://code.jquery.com/jquery-2.0.3.js > /dev/null
real 0m0.433s
time curl http://code.jquery.com/jquery-2.0.3.min.js > /dev/null
real 0m0.210s
Is it proved now ?
Edit: Off course I didn't ran these requests only once.
The obvious next question is "can't you achieve the same thing with gzip":
time curl http://code.jquery.com/jquery-2.0.3.js > /dev/null
236k bytes
real 0m0.432s
time curl http://code.jquery.com/jquery-2.0.3.min.js > /dev/null
83612 bytes
real 0m0.323s
time curl http://code.jquery.com/jquery-2.0.3.js --compressed > /dev/null
87509 bytes
real 0m0.273s
time curl http://code.jquery.com/jquery-2.0.3.min.js --compressed > /dev/null
34066 bytes
real 0m0.215s
I think that people should be more skeptical of the complexity introduced by things like minification, but the advantages are pretty clear, even with compression.
This still doesn't show that actual site performance is improved. Also, gzip is not enabled on that server, so I think it's a less realistic scenario. I'm certainly being pedantic, but I've run into similar surprises before.
> Most with absolutely zero data to back up that it provides any sort of useful improvements
While it depends on a lot of factors, generally speaking minification is a good thing especially for mobile. There's really no downside in doing it (see next point).
> justify the difficulties it introduces in debugging
What difficulties? You should use a build process that minifies for your production site but not for testing. If you need to debug the live, minified files you can use source maps[1].
I 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.
This 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 results seem pretty significant. Besides, the worse your connection is, the more you will appreciate these techniques.
Sprockets come's as standard with rails. In development the files are served separately, for easy debugging, but then they're minified/concatenated automatically for production.
You 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.
Not 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)
If 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.
rsync 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.