Presenting cases for which jQuery is valid isn't really saying anything about the cases in which it's not, of which I speak.
Look at the source code for any Google/FB/etc product & tell me 34KB doesn't matter. There are cases where size does matter. There are cases where extra HTTP calls are a big deal.
I don't see anything wrong with saying "check if you really need a tool before you use it".
Don't be surprised if libraries like jQuery and underscore are permanently cached (ie they come pre-cached on browser installation ) in the near future.
Which is why you don't concat your jQuery library with your js. They would assuredly have all versions of common libraries up to the current versions cached.
Your firefox users would have the jQuery api cached if you link it from google's api cdn. If they don't it will be fetched from your server. Same for the rest of the browsers that don't include precached libraries.
I've written enough on this thread ... at this point it should be clear that I fully understand all aspects of every single byte that is transferred over the wire.
No, Facebook is not going to bring in jQuery tomorrow. It would cost them millions.
No, Gmail is not going to use Angular. It would cost them millions.
No, your the user won't notice anything on your company's website if you include it. Even for the vast majority of the Fortune 100s. After it's gone around enough, the users will have almost zero impact because it will be cached meaning the client won't even request it.
Unless, of course, you want to write your own "smaller" version, then it won't be cached, and then you're hurting the company.
People need to profile and stop pre-optimizing and sweating over 34kb. 99.99% of developers do not need to worry about this.
If you are with Google, Facebook, or the other mega-companies, then yes, you do.
EDIT: Do you know how big the Reddit spritemap is so they can put the logo on the page and other minor things?
People that use the filesize of a library when declaring its svelteness completely, utterly miss the point. 34KB has nothing to do with execution time. A 0.1KB function can kill a browser.
You should not use the broken window effect to justify not doing something right. This is a known fallacy. You should always fix something broken even if something else is broken.
EDIT: I'm actually putting this edit at the top, because it's really valid. We're talking about 34kb JS here. I reloaded THIS COMMENT via the permalink. It takes 260 KB.
I stand by my point.
If you are worried about bringing in a 34kb JS library when looking over your entire project, there are other issues you should be looking at in the vast majority of situations.
There is the top 0.01% of websites where this would matter.
On all the others (and I've worked on some very high-volume sites) just using a better sever-side image pre-preprocessor can save you 100 times the bandwidth, while you are still worrying about jQuery (which, again, is usually 0 bytes, because it's been cached).
That alone has cut bandwidth for sites I've worked with under ASP.Net by huge numbers. That 50,000x figure isn't too far off due to people not profiling.
ASP.Net Core can serve 2,300% more requests per second than the prior full-framework version.
Meanwhile people are still staring at a 34kb JS lib.
If 34k is on your list of things to look into, you have an incredibly perfect site that undergoes very little changes.
25
u/EternalNY1 Jun 10 '16 edited Jun 10 '16
34KB!!!!
I used to run a PcBoard BBS in the late 80s on a 14.4k dial-up.
34KB mattered then.
As a simple example, I just checked a few pages with (incognito, no cache, Chrome dev tools network usage):
Reddit: 405KB
CNN: 1.4 MB
Yahoo: 2.9 MB
Netflix: 3.1 MB
Are we seriously discussing 34KB that, if I wasn't clearing the cache here, would be 0?
jQuery is 1% of the Netflix homepage, in the slim chance it even needs to be downloaded at all!
Pre-optimization (or totally incorrect fake "optimization") is one of the worst things in software engineering.
EDIT: I also have Ghostery and Adblock installed, I shudder to think what those numbers would look like if I was pulling the ads and beacons.