News for hackers. Stuff that matters.
Re:DynoSRC - Eliminate HTTP requests for JavaScript files by josteink on Thursday November 28, 2013 @07:00AM (#6814186)
> 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.

Re:DynoSRC - Eliminate HTTP requests for JavaScript files by AlisdairO on Thursday November 28, 2013 @07:07AM (#6814205)
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.
Re:DynoSRC - Eliminate HTTP requests for JavaScript files by byroot on Thursday November 28, 2013 @08:34AM (#6814410)
As 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.
Re:DynoSRC - Eliminate HTTP requests for JavaScript files by michaelmior on Thursday November 28, 2013 @08:47AM (#6814442)
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.
Re:DynoSRC - Eliminate HTTP requests for JavaScript files by byroot on Thursday November 28, 2013 @08:51AM (#6814453)

    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.

Re:DynoSRC - Eliminate HTTP requests for JavaScript files by bct on Thursday November 28, 2013 @09:06AM (#6814516)
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.
Re:DynoSRC - Eliminate HTTP requests for JavaScript files by michaelmior on Thursday November 28, 2013 @09:10AM (#6814541)
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.
Re:DynoSRC - Eliminate HTTP requests for JavaScript files by driverdan on Thursday November 28, 2013 @11:17AM (#6815131)
> 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].

1: http://www.html5rocks.com/en/tutorials/developertools/source...

Re:DynoSRC - Eliminate HTTP requests for JavaScript files by Cthulhu_ on Thursday November 28, 2013 @07:15AM (#6814220)
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.
Re:DynoSRC - Eliminate HTTP requests for JavaScript files by mping on Thursday November 28, 2013 @07:22AM (#6814233)
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.

Re:DynoSRC - Eliminate HTTP requests for JavaScript files by ollysb on Thursday November 28, 2013 @10:27AM (#6814885)
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.