Author Topic: Lighthouse to start calling out Javascript bloat  (Read 3016 times)

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9293
    • View Profile
Lighthouse to start calling out Javascript bloat
« on: January 16, 2021, 06:49:23 PM »
Or "unnecessarily large Javascript libraries" as the report calls them
https://searchengineland.com/googles-lighthouse-is-now-recommending-javascript-library-alternates-344940

We finally seem to have turned the corner on, "Let's just package in JQuery because the client is going to add it anyway, so we might was well just load it for every page, whether it's needed or not." Lots of Wordpress themes don't load it at all unless you have a plugin that demands it. Drupal by default does not load it. You have to write code if you want JQuery to load.

rcjordan

  • I'm consulting the authorities on the subject
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16345
  • Debbie says...
    • View Profile
Re: Lighthouse to start calling out Javascript bloat
« Reply #1 on: January 16, 2021, 07:11:13 PM »
>calling out Javascript bloat

They'll have an easier job if they just name the 4 or 5 sites that are svelte.

I run ScriptSafe on my browser.  It always stuns me when I open it up to look at what the page is trying to load.

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9293
    • View Profile
Re: Lighthouse to start calling out Javascript bloat
« Reply #2 on: January 16, 2021, 08:12:32 PM »
The way I see this, this is a report that speed-conscious clients can show to developers and speed-conscious developers can show to clients.

It's really hard to explain to people the concept that every "nice" feature has a cost. I recently was doing some performance profiling on a Wordpress site. That little author box at the bottom of each page? It resulted in 79 queries on pages that have and author box and 26 queries on pages that don't even have an author box (presumably to mess with a rel=author tag it seems to insert). It also loads about 35kb of Javascript and some amount of CSS.

The queries are simple and fast, so it doesn't change TTFB very much, but when you multiply that out times a dozen "nice little features" you can quickly add a couple of seconds to load time even on a fast connection. Some clients get it and they're willing to say, "Okay, that feature is not worth the speed hit," and "I understand the downside, but that's a must-have feature." But some clients just want it to look good on a fast connection and fully cached browser. And some developers don't know the difference.

Most sites being developed on a budget have three choices:

1. Skip that feature altogether. Sometimes you can and sometimes you can't, but nobody is going to be excited to book a hotel that is just a black and white all-text site. So you have to have some "costly" features. One person's bloat is another person's essential feature.

2. Drop in a bloated plugin that loads a JS library, sometimes even an entire CSS library like Bootstrap, some custom JS and CSS, and then make a lot of DB queries and quite often don't even restrict this to the pages where the plugin is active. This is cheap and fast in the build phase and therefore attractive to both client and any developer on a fixed bid or a deadline or both.

3. Custom code something bespoke that does only what is needed and nothing more and is fast and lean and requires somewhere between a few and many hours of dev time. On a site that I marketed, but did not develop, the developer of record was often quoting us $7000 or $12000 for basic widgets (things that I was doing for clients on Drupal sites in a morning, but the site in question was Sitecore, so I have no idea who hard/easy those things were).

So the path of least resistance and greatest bloat is path #2.

I often take that path for the reasons given
« Last Edit: January 16, 2021, 08:19:51 PM by ergophobe »

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9293
    • View Profile
Re: Lighthouse to start calling out Javascript bloat
« Reply #3 on: January 16, 2021, 08:53:59 PM »
Of course, if you were the client, it would look like this

https://perfectmotherfuckingwebsite.com/

rcjordan

  • I'm consulting the authorities on the subject
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16345
  • Debbie says...
    • View Profile
Re: Lighthouse to start calling out Javascript bloat
« Reply #4 on: January 16, 2021, 09:21:31 PM »
>your website

Rumbas, Torben, Drastic, & Travoli will confirm that my websites would have much more lime green & pastel orange.  Seriously, the national hotel booking site that brought in the monthly $$$ (2005-2008-ish) was lime green & pastel orange and long columns of text links, hhh.  (BTW, this was the site that got an online credit shout-out and link from Neil Gaiman for use in researching American Gods.)

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9293
    • View Profile
Re: Lighthouse to start calling out Javascript bloat
« Reply #5 on: January 16, 2021, 09:48:57 PM »
>>Neil Gaiman for use in researching American Gods

Nice!

rcjordan

  • I'm consulting the authorities on the subject
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16345
  • Debbie says...
    • View Profile
Re: Lighthouse to start calling out Javascript bloat
« Reply #6 on: January 16, 2021, 10:03:37 PM »
>perfectmotherfuckingwebsite

To do the high volume of online reading that I do, I block or alter many elements of the sites --headers, footers, side bars, ads.  So that perfectmotherfuckingwebsite doesn't look all that foreign to me.

You'd be surprised at the number of sites that have images & videos being loaded from only-god-knows-where. Many times, I give up trying to unblock them.