7 ms·
> Now I know what you may be thinking, that doesn’t sound like a lot of data, especially compared to images which can be multiple megabytes in size. But when it
by rob74 4y ago
> Now I know what you may be thinking, that doesn’t sound like a lot of data, especially compared to images which can be multiple megabytes in size. But when it’s on every page, from a web performance perspective, it equates to a lot of data.
Er... the utility of jQuery in 2022 aside, I would say: if it equates to a lot of data when it's on every page (of a single website), you're doing something wrong?! I mean, caching content between different domains is not a thing anymore, but on the same domain jQuery should only be loaded once?
- Izkata 4y agoMaybe they have a bundle per page and it's in each one: https://www.npmjs.com/package/jquery https://www.npmjs.com/package/jquery
- ClearAndPresent 4y agoThe article goes on to explain that they are optimising for extremely low spec devices used by financially and socially disadvantaged users. The majority of their users load pages in less than 1s (likely due to caching and connection). Some users take 25s or more to load a page. It is for these edge cases they were testing.
- tomgp 4y agoIf they're concerned about financially and socially disadvantaged users perhaps the place to start helping those people would be on the universal credit login page which currently delivers 100+ kb of javascript for a couple of form fields.
- 00deadbeef 4y agoThey're testing against a hypothetical user on a 2G cellular connection. I can't see many situations where that would happen. Being poor doesn't mean you can't afford 3G because every data plan in the UK includes 4G as a mimimum. Often 5G is included too. You have to be extremely rural to drop down to 2G and rural people are often better off. Poorer people tend to be in urban areas that have better digital infrastructure.
- Jaxan 4y agoI think it is a great mindset to try to be as inclusive as possible. It might actually improves everyone’s experience.
- TedDoesntTalk 4y ago
- ClearAndPresent 4y agoI can't downvote you, and being as dismissive of you as you are of these efforts would simply create more rudeness. Instead, consider why a governmental agency might want to be as inclusive of as many users of its services as possible, and how your miniscule slice of the world, advantaged as it is, might blind you to that motivation.
- TedDoesntTalk 4y agoIf you want to help the disadvantaged, don’t kid yourself that removing jquery from your website is doing it.
- pixl97 4y agoYou're conflating having a 5G connection with a 5G connection running fast. Now, I live in the US, so maybe the UK has much better infrastructure, but cell phone internet service can be slow anywhere. I've had that 5G link with full bars in the middle of a city and could barely pull anything. The difference with me having money to spend is I can easily do any number of things about it, such has have a different internet service at home, or pay to stay get something in an internet cafe while 'working from home'.
- Liquid_Fire 4y agoSounds like you live in a big city? In the rest of the UK, there are many many places, even in large towns of 100k+ people, where the mobile signal is absolutely terrible. Whether it's 4G or not doesn't matter if the signal is too weak to sustain a reasonable speed.
- firecall 4y agoLoaded from the Internet once. So it's cached, but the browser still needs to access and load the file! :)
- CJefferson 4y agoThe article is talking more about the execution time to read, parse, and execute the library -- that isn't cached at all.
- teknopaul 4y agoSeems like the writer hasn't heard about the trick of putting js at the bottom of the page, or the async html5 tag. Looks like the had jquery in the head section on every page. That's not really jquery or javascript's fault.
- ClearAndPresent 4y agoThe writers are Matt Hobbs and Andy Sellick, respectively Head of Frontend Development and Senior Frontend Developers at GDS. They may have considered alternative options. Here's a previous article explaining why they did what they did: https://insidegovuk.blog.gov.uk/2022/08/11/how-and-why-we-removed-jquery-from-gov-uk/ https://insidegovuk.blog.gov.uk/2022/08/11/how-and-why-we-re...
- exodust 4y agoThat article doesn't address the point raised: their placement of jquery in the head of page was likely the cause of the performance issues more than the presence of jquery.
- atoav 4y agoYeah but for what? I have been writing vanilla js for years now and aside from the sometimes slightly more convenient syntax I haven't missed a thing where using jQuery would have helped me over not using it. I don't say anything against loading useful javascript libraries, but too many websites load 1 MB of libraries just to get a result that they could have achieved with a few lines of handcrafted vanilla js. This is not just about performance, but every piece of code you add increases the attack surface and the number of moving parts that can fail. Not that every webpage has to be minimalist and barebones, but there are tradeoffs to be made and too many people just import the whole world, their neighbour and their dog without a second thought.
- codedokode 4y agojQuery is more convenient to use than vanilla JS. Vanilla JS is too verbose. If only jQuery was modular and didn't require to load 300 or 400 Kb of code. Also it is difficult to find non-jQuery library of a good quality. For example, I was looking for a small library to send and receive JSON via HTTP, and ended up writing my own wrapper around XMLHttpRequest (fetch() is a poor choice, it is not supported well in older browsers and it has no advantages, and fetch() requests cannot be aborted) because there was no good library for this. Other libraries either do not support all necessary browsers or are overengineered and too large.
- krapp 4y ago>If only jQuery was modular and didn't require to load 300 or 400 Kb of code. JQuery's own site says the library is 30 to 40 Kb, not 300 or 400. The minified JS file I downloaded of the latest version is 87 Kb, so I assume the rest would be taken care of with zip headers. Are people routinely serving the uncompressed version of the library?
- mejutoco 4y agoAgree. Plus one can use a cdn to increase the chances of the library being already downloaded.
- retube 4y agoI was thinking the same. However from the article it seems the issue is actually less with the downloading, but more with the parsing and execution, which is blocking, and has a material impact for users on slow devices.