M
Martin Rinehart
How much javascript would you have when you decide that minifying is
called for?
called for?
How much javascript would you have when you decide that minifying is
called for?
How much javascript would you have when you decide that minifying is
called for?
Martin said:How much javascript would you have when you decide that minifying is
called for?
Jorge said:I always try to serve them minified, BUT, do not forget to keep the
non-minified sources in a safe place: usually a "sources" folder (a
"deploy" folder holds the minified versions).
.CSS and .html files can be "minified" too...
A 1000 lines .js with soft-tabs has several kilobytes of %20's...
Also, whenever/if the UA supports it (Accept-Encoding: gzip) serve it
gzipped as well.
How much javascript would you have when you decide that minifying is
called for?
Gregor Kofler said:Martin Rinehart meinte:
Never? I use JSMin to strip comments and trailing spaces
occasionally. Serving one larger file instead of several small ones,
and delivering it gzipped will yield *much* better results, than all
this minifiying fuss.
Martin Rinehart said:How much javascript would you have when you decide that minifying is
called for?
Since no human beings (possible savants aside) can decipher minified code in
a reasonable amount of time so as to compare if the code they use is
equivalent to the code that is in the `deploy' "folder", what should it be
good for? That's the core problem with minifying: you test code but you use
completely different code; the tests, as thorough as they may have been, are
ultimately futile. Especially as most people don't even know how the
minifier works that they are using.
So what? Assuming "several" means 2 (KiB)
that's about 0.293 seconds
download time on a 56k modem in the best case (56 kBit/s), about 0.341
seconds in the worst case that I have seen yet (48 kBit/s).
Literally
in the blink of an eye already, and broadband Internet connections,
which are more than 26 times faster than that, tend to be more common nowadays.
This. And also: nothing will reduce the size of a js file better than
gzip.
rf said:Why minimize a Javascript file to save the odd K or two then the same page
probably has a dozen images that could be better compressed (at almost zero
loss of quality) saving hundreds of K?
Jorge said:2 spaces per tab stop per line account for much more than that.
...and there are millions of mobile users out there.
What's in your opinion the number of kiloBytes of junk that is ok to send
again and again and again ?
You don't serve large script files to mobile devices.
Anyhow, for 2 KiB that is
13.0 kbit/s on GSM, (...) etc etc
And, as others have already noted, if you are worried about the script size
you really should be worried about the document and image file size first..
Wrong question. Whitespace is _not_ junk.
Douglas said:rf wrote:
I highly recommend that you get Steve Sourders's book on performance.
Jorge said:You don't know what you're talking about: The last iPhone webApp that
I have written (not counting iui.js): 2256 lines of JavaScript, 64592
characters -> 43286 characters minified (conservative setting) ->
11561 bytes gzipped.
Minification alone shrinked it by 20k+.
Mobile users don't get that speeds, those are (in theory) maximum
speeds, nothing to do with what you really get.
Jorge said:You don't know what you're talking about: The last iPhone webApp that
I have written (not counting iui.js): 2256 lines of JavaScript, 64592
characters -> 43286 characters minified (conservative setting) ->
11561 bytes gzipped.
Minification alone shrinked it by 20k+.
Mobile users don't get that speeds, those are (in theory) maximum
speeds, nothing to do with what you really get.
That said, you don't even see the contradiction: cutting off 20k+ due to
minimization from what, about 100k+ of code? And you are actually caring
about mobile users? That's ridiculous.
That said, you don't even see the contradiction: cutting off 20k+ due to
minimization from what, about 100k+ of code? And you are actually caring
about mobile users? That's ridiculous.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.