315 points · by kevinak · 4y ago · 264 comments
Still, the results are such a stretch as to not have that much meaning. They have to descent all the way to 2G to see any meaningful difference, and I'm assuming they are cold visits (typical in lab-based testing).
For those exceptional users, this creates a difference from very poor (12 seconds) to still poor (9 seconds). Probably less because they'd normally have a warmed up cache.
Is it empathetic to improve performance for those users? Very much yes, do it as far as you budget allows for. But as it comes to jQuery specifically, the conclusion is that its negative impact is negligible.
And even for "normal" users, shaving milliseconds matter. The general idea is that a UI should respond within 100ms to feel instantaneous. More than 1s and you interrupt the flow of thought. According to Google research, increasing page load time from 1s to 3s increases bounce rate by 32%.
Performance matters, a lot. I am not living in the UK, but if I was, I would be happy to pay taxes that make government websites 25% faster.
And even without the performance benefits, I consider removing dependencies a good thing. jQuery was great in the IE6 days, but now that even 10 year old browsers have decent JS, it is not as important as it once was. Modern versions of jQuery don't even support IE6 anymore.
That is not what the person you were replying to claimed. Their claim was that the overall effect of removing jQuery was negligible, and made a persuasive argument to support it, while also acknowledging that making modest improvements to the experience of a minority of users was an admirable achievement.
What is negligible is 12 down to 11.999 seconds because you prematurely optimized
Who could disagree with that verdict over an imagined scenario? I would even go so far as to say it could be considered negligible whether or not the optimization was premature or not.
And even for "normal" users, shaving milliseconds matter. The general idea is that a UI should respond within 100ms to feel instantaneous.
9 seconds is pretty fucking far from 100ms. Far enough that I feel like shaving milliseconds off does not in fact matter to the majority of “normal” users.
According to Google research, increasing page load time from 1s to 3s increases bounce rate by 32%.
Fascinating. What does the research say about increasing the load time from 9 to 12 seconds? Those are after all the figures that are relevant to this discussion.
Performance matters, a lot. I am not living in the UK, but if I was, I would be happy to pay taxes that make government websites 25% faster.
I’m sure the UK government is thrilled that you approve of how they spend their tax revenue. But just to reiterate: We’re not talking about a 25% improvement of websites across the board. We’re talking about a 25% improvement of a specific page for a small subset of users.
And even without the performance benefits, I consider removing dependencies a good thing. jQuery was great in the IE6 days, but now that even 10 year old browsers have decent JS, it is not as important as it once was. Modern versions of jQuery don't even support IE6 anymore.
I doubt anyone disagrees with this as a general statement. Certainly it would probably be a mistake to take on jQuery as a dependency today. However, it does not cost nothing to remove jQuery from a code base that has depended on it for a long time. And the cost has to weighed against the risk and the cost, not least of which is the opportunity cost: What could the programmers tasked with removing jQuery have done with their time instead?
Developers really don't care. They will claim otherwise with great conviction, but its all posturing and bullshit. If developers did care they would measure everything and challenge popular assumptions. Instead most developers want to randomly guess at what works and instead talk about tools. That's why most pages will never come close to being vaguely fast. 9 seconds is still really slow.
My hamster mobile can achieve 0 to 60mph in under 8 seconds while a Corvette C8 takes about 2.6 seconds. Nobody gives a shit what socket wrench they used to put the tires on.
It does still help of course, just at tiny fractions of the impact that Google saw.
He and Richard P. Kelisky, Director of Computing Systems for IBM's Research Division, wrote about their observations in 1979, "...each second of system response degradation leads to a similar degradation added to the user's time for the following [command]. This phenomenon seems to be related to an individual's attention span. The traditional model of a person thinking after each system response appears to be inaccurate. Instead, people seem to have a sequence of actions in mind, contained in a short-term mental memory buffer. Increases in SRT [system response time] seem to disrupt the thought processes, and this may result in having to rethink the sequence of actions to be continued."
“The Economic Value of Rapid Response Time”
https://jlelliotton.blogspot.com/p/the-economic-value-of-rap...
The thing with bounce rate is that you don't know WHY the user bounced nor did you know their intent. Typically analytics aren't even loaded yet. Sure enough I believe there to be a correlation forming as you dramatically increase page response time, but you still cannot attribute a high bounce rate to performance alone, which the often quoted line does imply.
Case in point, most of Google's properties don't even come close to their own performance guidelines.
That scale of attention span places both 9s and 12s in the exact same box: you've completely lost your user's train of thought.
Is 9s better than 12s? Obviously, yes. But that wasn't the point. My point was that there is such a thing as diminishing returns. If I were to follow your train of thought (performance absolutism), we should next optimize for WAP, if you're old enough to know what it is.
Somewhat shockingly according to https://www.cambridgewireless.co.uk/news/cw-journal/why-2g-w... 12% of mobile network connections in the UK are still on 2G? That's surprisingly high usage, and would definitely be worth optimizing. Although usage that high would then explain why 2G shutdown is still 10 years(!) away for the UK.
Phones still on 2G also seem likely the be phones that don't have the best of web browsers, so cold visits may still be more representative than it seems like it should be.
Several years ago, jQuery was practically a requirement, but now vanilla JS offers many of the same features. There's a huge amount of older websites that relied upon jQuery but don't really need it anymore.
Sure, I think jQuery these days is largely legacy developer ergonomics... I admit there are parts of those ergonomics that I miss. Especially when comparing it to modern tool-heavy transpiled/compiled/whatever JS development which is way more opinionated than using a simple utility library.
Indeed - websites are the most convenient way to access government services.
So it's important that government websites don't rely on technology that isn't universally available. So I wish gov.uk sites would stop insisting on a smartphone (or SMS) for 2FA. Phones have these problems:
* They cost a lot.
* It's impossible for the average user to check the 2FA app is secure.
* They run on batteries that go flat.
* they are not owned by their owners.
Please, always offer email as a 2FA choice.
IMO this should also mean they have offices and phone lines with minimal hold time. Not everyone can use the web fluently, and a website is a cheap replacement for human guidance.
- The UK: https://design-system.service.gov.uk/
- The US: https://designsystem.digital.gov/
- Canada: https://www.canada.ca/en/government/about/design-system.html
- Argentina: https://argob.github.io/poncho/
- Italy: https://designers.italia.it/
- Singapore: https://www.designsystem.tech.gov.sg/
- Estonia: https://brand.estonia.ee/
it was the official design system until it got defunded, now I believe it's run by open source
It's open source on GitHub: https://digitalnsw.github.io/nsw-design-system/
https://www.salute.gov.it/portale/home.html
https://presidenza.governo.it/USRI/confessioni/diritti_umani...
However, I believe it's mostly the federal ministries that use it.
Edit: alright, CZ, UA and RU further down the thread are the same, I just hadn't gotten to those yet. Still, absolutely unacceptable for a government design standard.
I feel like that's a great quality. As for restrictive, that's a valid concern.
I wish there was more buy in by local councils of this system, there are some incredibly poor local government sites.
Last time they collected my name and address over the phone and got both of them wrong.
Then they were sending letter to a person that doesn't exist, to an address that doesnt exist, never used my email or phone number, didn't respond to my email, but still told me it's my fault!
You may be interested in Local Gov Drupal. Unfortunately they've defined themselves around a specific tool, rather than a design library, but maybe that was what it took to get them to come together. Seven councils are using the solution, and around 30 councils are involved in the initiative, but there is plenty of scope for the 300+ others to leverage the work and join the initiative.
Not much!
/me former Drupal developer. Drupal makes super-heavyweight pages, and is a real pain to learn. There is no backwards compatibility between major releases; to upgrade, you have to rewrite your site.
I burned 8 years working on Drupal sites. I made a living, but I ended up hating Drupal with a passion.
They also have terrible web based services, akin to Frontpage '97 on a good day.
Plus the (at times) antagonistic relationship between Whitehall and local government I think means they don't want to necessarily use something they associate with the incumbent administration.
Does that system require absurd cookie banners? Gov.uk should be leading the charge against ridiculous cookie banners.
In Denmark we are like: Need a domain for our common ID and login system? How about nemid.nu, where .nu is the TLD of Niue, but "nu" means "now" in Danish, so lol, let's use that. On top of like 7 other domains that users are randomly redirected between during use.
(Unlike with almost every other ccTLD, UK is also not the ISO code for the country—GB is—and is instead “reserved”, which is why I must struggle to remember each time that the BCP 47 for Ukrainian-in-Ukraine is uk-UA.)
The sad fact of the matter is that structured and controlled ccTLDs where you knew what you were dealing with from the name alone are increasingly being supplanted by second-level domains.
This thread on notification banners is an excellent example[1].
I think if this was started today they'd fit into GitHub's discussions better than issues, as that's what they're used for. Eventually, with enough support, these things might make it into the design system.
[0] https://github.com/alphagov/govuk-design-system-backlog/issu...
[1] https://github.com/alphagov/govuk-design-system-backlog/issu...
Bonus: The ONS has some pretty smashing data visuals https://www.ons.gov.uk/peoplepopulationandcommunity/healthan...
I applaud the UK for this - the US and its various federal agencies/states/cities/towns should consider the same, not only as a cost saving measure, but making the experience predictable across many different sites.
I find it exceptionally galling that the so-called Inflation Reduction Act sends $80 billion to the IRS, of which $15 million is earmarked “to fund a task force that would study the cost and feasibility of creating a free direct e-file program.” Spoiler alert fellas - it’s feasible, and it should have been done 20 years ago.
Government: https://www.rijksoverheid.nl/
Tax service: https://www.belastingdienst.nl
Corona dashboard: https://coronadashboard.rijksoverheid.nl/
Student loans: https://duo.nl/particulier/
Nice that the Universal credit page is 17 seconds faster, but has anyone else noticed how they use dark patterns to screw you out of money you are due by making it really hard to submit accurate year end accounts if you have submitted an estimate at Tax credits renewal time because you didn’t have your year end accounts yet. The only way is to phone and go on hold for 2-4 hours or to write a letter to an address that is not listed anywhere on the website. I am having to pay back £75 / month of tax credits that I was legally due because I didn’t manage to submit this information to the correct place by the deadline. What is even more annoying is they have all this information as tax returns are submitted to the same government department and have all the information they need. The two departments even share the same bank account number for tax payements and tax credit repayments and use the same letterhead. They used to sync this information automatically but they changed the system at some point around 10-12 years ago. I can’t imagine why they have done this apart from it is designed just to screw money out of small business owners and sole traders that don’t make much money e.g. cleaners, hairdressers, window cleaners, dog walkers etc. It’s not setting a very good example if you want people to be honest and declare all their cash income!
TFL was almost bankrupted by Covid, I for one will give them a pass on the ugly advertising on their site.
However, looking at [0] and [1], advertising only covers about 1% of their budget. That banner ad will be tiny fragment of that.
0: https://tfl.gov.uk/corporate/about-tfl/how-we-work/how-we-ar...
1: https://www.statista.com/statistics/898278/transport-for-lon...
For small projects, you almost don't need frontend chops anymore to deliver nifty looking goods.
I was kind of stunned to learn that even Apple uses MUI.
The new standardised GOV.UK sites are missing features and content.
There's a sense of dumbing down to fit the design standards.
On that note, i expect in the coming years some UK startup will be selling "government as a service"
Some (most?) of the other gov uk sites have megabytes of js on them.. eg. https://coronavirus.data.gov.uk/details/testing?areaType=nat...
The real problem is that jQuery is not new and shiny, and nobody wants to be doing jQuery in 2022.
jQuery is just pure overhead with no real functionality compared to vanilla js.
If you're making an actual application (think Discord/Spotify) then yes, it becomes a necessary abstraction. Your personal website or news website (or many others) using React is a waste of my bandwidth and CPU cycles.
jQuery lets you imperatively manipulate the dom.
They're different use cases; calling one useful and the other not isn't a very accurate representation.
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?
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.
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.
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?
Does {signal} not work yet? https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#a...
It is? You can use grunt to make your own version, excluding the parts you don't need.
Here's a previous article explaining why they did what they did:
https://insidegovuk.blog.gov.uk/2022/08/11/how-and-why-we-re...
So it's cached, but the browser still needs to access and load the file! :)
> We run tests every day on GOV.UK pages using specific simulated devices and connection speeds. Because we can repeat these tests every day, it allows us to monitor what the changes we are making to the site are doing for real users visiting GOV.UK.
with no mention whether those were all cold start loads or simulated browsing scenarios.
Not wanting to diminish the effort or challenge the conclusions — I know that jQuery does quite a lot checks and feature detecting stuff when it initializes, even when it is not used (so removing it must have significant impact) — but if those measurements were done with cold start empty cache single loads each time, it might count some "extra" time (download, parse, tokenize, build AST) that usually precedes only initial load and "first run" of static library and is not present in subsequent interactions.
> For example, for a simulated user visiting the Universal Credit start page on a low specification device and 2G mobile connection, we can clearly see from the graph where the jQuery change was made.
Even if the cost of jQuery can be amortised over multiple page views in a session, someone's still got to have a successful first page view before they can view any more
For a service like Universal Credit that's aimed at the less well off then cheap i.e. slow devices, and mobile connectivity means that the service has to be as easy to access as possible
Again, I really do not want to attack their conclusions, I'm just curious how much (if at all (!)) would browser cache be beneficial here.
(I'm not even sure browser generally caches once parsed chunks, but I assume they probably do.)
[1] https://www.gov.uk/universal-credit (presumably)
Also, I don't visit UK government websites that often -- so I'd suspect I am "cold cache" whenever I do.
From a quick googling, yes, at least some of them. (TIL):
https://stackoverflow.com/questions/1096907/do-browsers-pars...
>> The third time (i.e. a hot run), Chrome takes both the file and the file’s metadata from the cache, and hands both to V8. V8 deserializes the metadata and can skip compilation.
— https://v8.dev/blog/code-caching-for-dev
> Also, I don't visit UK government websites that often -- so I'd suspect I am "cold cache" whenever I do.
For first visit with given browser and profile (or incognito mode), sure.
But if you visit more than single page during same session, you probably have more than a "cold cache". That measured page mentioned in the article seems to be guidepost with only most important excerpt of the content, so it seems plausible you would "click around a bit" from there.
https://v8.dev/blog/code-caching-for-devs#use-service-worker...
But in fact, jQuery is largely not needed since Internet Explorer lost market share and there's less of a need to have lots of workarounds for it.
I would massively prefer to have a blank page, or a page with no buttons, and wait a few seconds for the buttons to appear in their final locations, than this.
I find most sites using this kind of progressive loading are completely useless during the loading phase... What's the point of showing the user a page full of skeleton/loading placeholders? You might as well have just server-rendered the whole thing and made the user wait an extra second or two.
The idea being the browser would know how to render the things around the picture without needing to download the picture first, preventing the page from jumping around as the quicker and lighter HTML was downloaded and rendered first.
That "jumping around" is now referred to as "CLS" -- Cumulative Layout Shift -- one of the "Core Web Vitals" metrics used to quantify performance-related UX.
You can document.write() in js by default so it has to wait for the js to load.
"async" tag stops the default behaviour but the person writing the blog does not sem to know what.
As someone who's late to the webdev party I feel that jQuery is pretty awesome (all I ever heard is people poopoo it). The vanilla API for the DOM manipulation is just plainly awful and borderline nonsensical so I'd say jQuery is still very much needed.
Though if jQuery works for you and isn't a performance issue, then by all means keep with it. It may not be ideal, but good enough and does the job. Let the naysayers spend their time debating whether you should or not, and just get on with making things!
---
[1] selection engine, chained selections, chained modifications, …
[2] not the issue it once was, if you can abandon IE and old Android browsers from your supported UAs or can deal with any issues that crop up individually
[3] again, if you can afford to drop support for legacy UAs
With Jquery it seems the balance of writing code to make page active, and not writing too much code, is correct.
I guess I prefer reading code than docs.
jQuery lets one use an innerHTML-ish style, but it is supposedly guarding against injection attacks in some way. I don't like the hand-wavy way it claims to guard against injections, as basically it has no way to tell what part of a string was meant to be text, and what was meant to be elements.
So I ended up coding my own library. No conversion of strings to elements, so naturally no injections. Very small and simple. But saves a ton of typing when generating DOM structures in JavaScript: https://github.com/NoHatCoder/DOM_Maker
What was not amazing was the manner in which many projects utilized them.
<script type='text/javascript' src='https://insidegovuk.blog.gov.uk/wp-includes/js/jquery/jquery...' id='jquery-core-js'></script>
document.getElementById('id').style.display = 'none' vs $('#id').hide();
Please don't put images of multi-megabytes size on web-pages. My boss put a 10-megabyte image on the homepage of one of our clients; he fancied himself a photographer, and he took the photo. It gave a 10s page-load time from a desktop PC. I offered to shrink it for him, which would have taken 2 minutes; he wasn't having it.
I don't think it was pride in his photo; I think the client wasn't paying their bills, and he wanted to punish them.
But please, shrink your images to fit on the screen of your most-capable target device. There's no need for super-hi-res posters on websites.
Please stop using desktop sized images across all viewports when using background images.
How does browser caching come into play here? Doesn't it make a difference?
But I'm not sure that downloading 32kb on each page load is their biggest problem. It sounds like a lot of the cost of jquery is parsing that javascript on each page load - especially on low specced devices. Javascript parsing traces (as far as I know) aren't reused between page loads at all.
It only needs to get the file from the Internet once, but the browser still has to load the file and work with it on each page load! :-)
How that is handled exactly... I don't know LOL :-)
If only web developers cared about *all* users the web would be much less crappy.
Author of this article is apparently unaware of browser caches.
> JavaScript is known as a “render-blocking” resource.
Yeah, if only there was, like, an async attribute or something.
> The graph below shows time to interactivity dropped from 11.34 seconds to 9.43 seconds
So, jQuery is way too heavy for these people, but interaction tracking analytics (these packages usually start around 200kB) is perfectly fine?
> total page load time dropped from 19.44 seconds to 17.75 seconds
Burying the lede here, if my team celebrated a 17 second page load, we'd be fired on the spot. Going out on a limb here to suggest jQuery is the least of their problems.
Caching? Set cache headers such that the jquery.js rarely/almost never expires and requires a re-fetch?
Gov.uk drops jQuery from their front end (90 days ago|437 comments) https://news.ycombinator.com/item?id=31434434
How and why we removed jQuery from Gov.uk (5 days ago|43 comments) https://news.ycombinator.com/item?id=32423422
I have worked with these technologies professionally:
- Vanilla js targeting ie5+
- jQuery
- MooTools
- Angular
- KnockoutJS
- virtual-dom
- React
- Typescript
I've also tried out a handful more in my spare time, like Vue, Preact, and Elm.
If your list does not include any modern stuff, then your opinion is worth zero to me, because your reference for what's good is horribly outdated. If your list matches or exceeds mine, and you still prefer jQuery, then I'll be bewildered but at least your opinion is interesting.
It's not cached?
And with HTTP2 it doesn't really matter if you have more than 8 resources.
I doubt query selectors will have any meaningful impact on page load
The website is a bit of a parody, but the numbers are real: http://vanilla-js.com/
For similar functionality, modern, native JS is orders of magnitude faster than almost all JS libraries. The libraries obviously do more, but they also account for older browsers and just by their nature have a lot more overhead.
The point about edge case devices also should not be missed – the assumption that "we have 5G" should be a target is really quite surprising. There are always cases for a more optimum website. When traveling and there is low signal, or people on pay-per-MB plans, and more – there are all kinds of people that can benefit from a slimmer and lighter (compute-wise) website. The stupid fast chips are not used by everyone, in fact, not even the majority.
I'm not. Rural areas often have unbelievably bad internet connections. In my home town we have around 2 MBit/s for broadband connections and 5G is not there either.
You lose nothing by optimizing your sites for the worst possible case and not for what you'd like everybody to have.
That's not true. The overwhelming majority of user-perceived latency for mobile devices accessing typical websites occurs after the initial HTML response has been received. See eg https://wpostats.com or https://httparchive.org for data.
> But the GOV.UK pages are written in simple HTML. They are designed to be lightweight and will work even on rubbish browsers. They have to. This is for everyone.
It's much less common in the UK than the US to buy a smartphone on credit - cheap phones with cheap pre-paid plans are normal - so low-end models with very slow chips are more common. The sort of thing where even scrolling through your contact menu will induce lag.
The people who need government services the most won't have this
Just want to make sure we aren’t just making assumptions.
I would think most folks of any income would replace their phones even every 5 years, simply because the batteries would’ve died. And I’d think any phone in the past 5 years would be reasonably decent. Even the ultra cheap ones.
Plus with networks, cell carriers are at least incentivized in general to get folks off 3g into lte since it’s cheaper for them to not have to maintain N systems.
For data maybe Android share in Europe could be a start, or people with prepaid plans. In my experience both are much more prevalent in Europe than in the US.
Device memory is a good proxy for how powerful the phone is
Effective connection type will give some data on network performance