6 ms·
For those who haven't tried it, disabling JS completely makes pages load surprisingly quickly. You'll also realise how many sites inanely use tons of JS (the bu
by userbinator 11y ago
For those who haven't tried it, disabling JS completely makes pages load surprisingly quickly. You'll also realise how many sites inanely use tons of JS (the bulk in bloated libraries of which a tiny fraction is actually used by the site) just to serve static content. But a lot of sites also continue to work fine, despite what "common knowledge" says.
So before you dive into micro-optimising JS, consider whether you even need all that JS at all. Of course this is unavoidable for certain sites which must be app-like, but if plain HTML and CSS is sufficient, then you will have effectively optimised the JS to its ultimate end. (Don't serve CSS with thousands of rules which you don't use either.)
- agumonkey 11y agoI installed dillo last year. It just fetches html, does a little bit of CSS layouting and that's it. Usually, the job is done by the time my finger leaves the left button. Gets you thinking.
- ktRolster 11y agoWhich means internally browsers are probably dying a performance death of a thousand cuts, too
- codedokode 11y agoI have JS disabled by default except some sites. I just want to notice that usually it is not only JS fault. Javascript in general is not slow - the problem is usually with third-party scripts (analytics, advertisement, social network buttons) that add huge load on a browser. They load large JS frameworks, create many iframes (and every iframe is like a new tab in a browser - it has own DOM, own stylesheets, its own JS VM), track events like mouse movement. For example Google AdSence can add several additional iframes per banner. For example, reddit frontpage (which doesn't have much ad) has 6 additional iframes. It makes 76 requests (775 Kb) while loading of which only 15 (taking 335 Kb) belong to reddit domains, other are third-party. So by just disabling third-party services (you can do it on the browser side) they can make the page two times smaller. Techcrunch has 19 additional iframes. It makes 273 requests (of which approximately 190 are third-party) and loads 2.1 Mb of data (of which approximately 1.1 Mb account for third-party domains). Opening single techcrunch page is like opening 20 new tabs in your browser. And as a site owner you cannot optimize your ad provider scripts. Yet you can "optimize" them out at a browser side as a user. Instead of blaming everything on javascript or jquery people should look at network tab in developer tools.
- kuschku 11y ago> And as a site owner you cannot optimize your ad provider scripts. You can, if you directly negotiate ad contracts.
- nitwit005 11y agoYou can sort-of optimize your ad javascript. Some of the ad networks are starting to require that you ads come essentially pre-packaged and be under a certain size. They still might have dumb code and overly fancy animations of course.