javascript – What is it about modern websites that make them so unbearably sluggish?

First of all, I’m not using some kind of slow Internet connection. And my PC is a monster, which can display a webpage full of stuff that I coded myself in HTML faster than I can perceive it loading.

But every single time I have to load any webpage on YouTube, Twitter, Reddit, Twitch, and a million other ones that I for example find in search results, it can take many seconds for the content to finally appear, if it appears as all. Frequently, there’s just an empty page, or some lockout message about how I’m in the wrong country or don’t have access to load it.

I use Pale Moon, not because it’s a good browser but because 100 % of all the other ones are infested with spyware. (Chrome and Firefox are entire unusable, and all the “others” are just skins to these browsers.) There is no need to tell me that Pale Moon is somehow “at fault” and that I “should switch browsers”. I cannot do so, because there is nothing left to switch to. The last real Opera version is from 2012.

Even if these major websites are somehow coded by complete novices who have no concept of programming or logical thinking, I simply don’t understand how it’s possible for them to cause my machine to crawl on its knees and often freeze entirely from just one page load. I used to be able to open hundreds of tabs of any website by middle-clicking on early 2000s computer hardware, but now, on a much more powerful machine, even one single tab with YouTube or Twitch or Twitter takes a million years to slowly load.

Even if they use a ton of weird JavaScript libraries and abstractions, and have zero regard for their users, I don’t understand how it’s possible for these libraries/frameworks to cause such slow-downs. I really, honestly don’t.

Can somebody please explain this once and for all? Are they doing things like:

if (is running_something_other_than_Chromium()) { for (var i = 0; i < 99999999; i++) eat_CPU_resources(); }

? It almost seems like it. For real.

Every time I have to shop for groceries, I have to slooooowly load these pages that should take 0.01 second in the worst-case scenario, but actually take 5-10 seconds to slowly build up, even though they contain nothing that would justify such loading times.

When you are subjected to this all day, every day, it really starts to affect you mentally. I have coded all kinds of “streamlined workflows” just to save time and in order to not load more pages than necessary from these sites, which is insanity. I would really appreciate it if somebody would explain how this can be once and for all, and not just say that “they use heavy JS libraries”, because JavaScript code runs ultra-fast and has been given extreme amounts of developer time and effort to optimize due to its central role in any non-ancient web browser.

(And on top of it, I use adblocking (uBlock Origin), so this is without even seeing any ads. If I also had to load those, each page would probably take an hour to load…)