r/programming • • Jun 09 '16

jQuery 3.0 Released!

https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/
1.1k Upvotes

354 comments sorted by

View all comments

Show parent comments

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.

3

u/roselan Jun 10 '16

NYT: 4.2 MB on load, 102 MB after 20 mins on page (without a blocker)

2

u/protestor Jun 10 '16

holy shit.

2

u/roselan Jun 10 '16 edited Jun 10 '16

My best bet is that there was a bug in an ad that kept dowloading shit over and over.

I checked because recently somebody claimed it was downloading tons of stuff. I had to visit several pages before I saw it happen.

edit: just checked again, and got 6.9 MB for one of their article.

0

u/[deleted] Jun 10 '16

Get uBlock Origin

-1

u/kyebosh Jun 10 '16

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

5

u/EternallyMiffed Jun 10 '16

C A C H E

1

u/MachaHack Jun 10 '16

With the increasing size of everyone else's web pages, your content isn't going to stay cached for very long.

1

u/EternallyMiffed Jun 11 '16

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.

1

u/MachaHack Jun 11 '16

Do they have the same version as you have? Probably not. Will they be able to cache it when you concat your js to reduce requests? No.

1

u/EternallyMiffed Jun 11 '16

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.

1

u/MachaHack Jun 11 '16

So if, e.g. Chrome does this,what about all your Firefox, IE, Safari users etc. What if you use Lodash instead of Underscore? Etc etc

1

u/EternallyMiffed Jun 11 '16

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.

8

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

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?

39.4kb.

Those tiny images are bigger than jQuery.

1

u/kyebosh Jun 10 '16

If you are with Google, Facebook, or the other mega-companies, then yes, you do.

That's all I'm saying, mate.

3

u/EternalNY1 Jun 10 '16

If your're in that job, you've done well.

0

u/civildisobedient Jun 10 '16

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.

-4

u/Naouak Jun 10 '16

Because most people are doing it badly, we can all do it badly ?

11

u/EternalNY1 Jun 10 '16

Because most people are doing it badly, we can all do it badly ?

I mentioned Reddit, CNN, Yahoo, and Netflix.

Not "Steve's Family Wordpress Blog".

I'm talking about developer's worrying about 34kb when one single small image on that site is more than that and should be 10 times smaller.

0

u/Naouak Jun 10 '16

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.

5

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

What exactly am I saying that's wrong?

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

Things like this:

http://imageresizing.net/

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.

1

u/BeowulfShaeffer Jun 10 '16

ASP.Net Core can serve 2,300% more requests per second than the prior full-framework version

This is relevant to my interests. Where did you get this number?

1

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

This is relevant to my interests. Where did you get this number?

http://web.ageofascent.com/asp-net-core-exeeds-1-15-million-requests-12-6-gbps/

You can see where the old ASP.Net and Node.js are sitting down on the bottom left corner of the graph.

ASP.Net Core on Windows and Linux is blazing fast.