5 ms·
I 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
by codedokode 11y ago
I 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.