473,657 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When to minify?

How much javascript would you have when you decide that minifying is
called for?
Nov 14 '08
50 3866
rf wrote:
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?
Because most browsers block the loading of additional assets until the
JavaScript file has been completely loaded, compiled, and executing. The largest
component is the loading time, and minification and gzipping are very effective
optimizations.

I highly recommend that you get Steve Sourders's book on performance.
Nov 15 '08 #11
Jorge wrote:
Thomas 'PointedEars' Lahn wrote:
>>A 1000 lines .js with soft-tabs has several kilobytes of %20's...
So what? Assuming "several" means 2 (KiB)

2 spaces per tab stop per line account for much more than that.
Even if its twice that amount it is still negligible as compared to the rest
of the file.
>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).

...and there are millions of mobile users out there.
You don't serve large script files to mobile devices.

Anyhow, for 2 KiB that is

13.0 kbit/s on GSM, ca. 1.260 s
14.4 kbit/s on CSD, ca. 1.138 s
115.2 kbit/s on HSCSD, ca. 0.142 s
171.2 kbit/s on GPRS, ca. 0.096 s
384.0 kbit/s on EDGE, ca. 0.043 s
384.0 kbit/s to 7.2 Mbit/s on UMTS, ca. 0.043 down to 0.002 s

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.
>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.

What's in your opinion the number of kiloBytes of junk that is ok to send
again and again and again ?
Wrong question. Whitespace is _not_ junk.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Nov 15 '08 #12
On Nov 15, 7:57*pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
>
You don't serve large script files to mobile devices.
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+.
Anyhow, for 2 KiB that is

13.0 kbit/s on GSM, (...) etc etc
Mobile users don't get that speeds, those are (in theory) maximum
speeds, nothing to do with what you really get.

--
Jorge.
Nov 15 '08 #13
On Nov 15, 7:57*pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
>
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..
Yeah, but not in this thread. This one is about minifying JS.

--
Jorge.
Nov 15 '08 #14
On Nov 15, 7:57*pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
>
What's in your opinion the number of kiloBytes of junk that is ok to send
again and again and again ?

Wrong question. *Whitespace is _not_ junk.
Huh ?

--
Jorge.
Nov 15 '08 #15
Douglas Crockford wrote:
rf wrote:
I highly recommend that you get Steve Sourders's book on performance.
It's probably worthy of adding to the FAQ.

--
comp.lang.javas cript FAQ <URL: http://jibbering.com/faq/ >
Nov 16 '08 #16
Jorge wrote:
On Nov 15, 7:57 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
>You don't serve large script files to mobile devices.

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+.
>Anyhow, for 2 KiB that is

13.0 kbit/s on GSM, (...) etc etc

Mobile users don't get that speeds, those are (in theory) maximum
speeds, nothing to do with what you really get.
Building into one file reduces the number of HTTP requests and adds one
file into the cache (not 20 or so, which can easily happen when applying
good old SRP).

If the file is minified, it will take less room in the cache. Cache
limits are finite. In mobile devices (like iPhone), cache is generally
not as large as a desktop browser.

Garrett
--
comp.lang.javas cript FAQ <URL: http://jibbering.com/faq/ >
Nov 16 '08 #17
Jorge wrote:
Thomas 'PointedEars' Lahn wrote:
>You don't serve large script files to mobile devices.

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.
I happen to own an iPhone 3G. Its support includes EDGE and UMTS. What was
your problem again?
Minification alone shrinked it by 20k+.
On EDGE (I'm not even talking about UMTS) that makes about 0.860+ s less --
blink of an eye.

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.
>Anyhow, for 2 KiB that is

13.0 kbit/s on GSM, (...) etc etc

Mobile users don't get that speeds, those are (in theory) maximum
speeds, nothing to do with what you really get.
13.0 kbit/s *is about* the transfer rate of (original) GSM (which is not
very common anymore), channel splitting, syncing, bit error correction, and
time slots already considered. You may be right about the other transfer
rates, however even then the time difference would be negligible.

And you still miss the point.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Nov 16 '08 #18
On Nov 16, 6:46 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
>
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's ridiculous:

"Cutting 30k by gzipping is allright, but cutting 20k+ by minifying
isn't."

duh!

--
Jorge.

Nov 16 '08 #19
On Nov 16, 6:46*pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
>
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.
This is ridiculous:

"Cutting 30k by gzipping is allright, but cutting 20k by minifying
isn't."

duh!

--
Jorge.

"Silly things such as logic, common sense, rational
thoughts or good manners are not allowed in this
forum."
Nov 16 '08 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
19954
by: sql-db2-dba | last post by:
Does DB2 just fudge it when it is an empty table? Is there a "formula" for average row size when you have variable length records. Or you really have to know what your application is packing into those varchar columns. Bill Leung leungb@aptea.com
4
5923
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a single RichTextBox on each page. In my controls loaded event I call my Render() method which configures everything appropriately. When setting up the TabControl the first thing it says is (not real var names):
5
555
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when it is invoked by pressing "F5", or when the web.config file is modified. In all these cases the web.config file contains <identity impersonate="false" />. The mysterious problem arrises when I set <identity impersonate="true"/> in the...
8
2564
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
32
3496
by: David Mark | last post by:
I've got a collection of functions that accept a function or object (paired with a method name) as a callback. For the longest time I have relied on this test. (typeof cb == 'function') This should work as well, but I am not sure how well it degrades in older browsers. I think there are issues with functions created in another context (eg frame) as well.
0
1634
by: shapper | last post by:
Hello, Does anyone knows any C# Library to Combine and Minify CSS and Javascript files? I was able to find a few Rails and Java tools but no .NET tool. This would be really useful for ASP.NET web applications. Thanks, Miguel
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.