Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Cost of JavaScript in 2018 (medium.com/addyosmani)
33 points by rtfeldman on Aug 3, 2018 | hide | past | favorite | 6 comments


I blame frameworks and the over-reliance on them.

People poke fun at StackOverflow over everyone answering every JavaScript question with "Use jQuery/React/$FRAMEWORK_OF_THE_WEEK", but its a real problem.

I have a browser game I've been writing, and I've just been using pure JavaScript with no frameworks. It's currently sitting at 28K for the JS+HTML+CSS, and that's without minification. Even when it's done, it'll be under 100K.

If I were to listen to anyone's suggestions for using a framework, I'd already be at 84K from jQuery alone.

"Oh, you want to do X? Well, that normally takes 4 lines of JavaScript code, but you can include this framework that turns it into a single function call!"


Unfortunately the realities of supporting a biz app leaves you with little choice. Sure you can do pure JavaScript, and we continually try. However at some point when that customer running IE9 calls you about another UI issue, you have to admit that you’re just reinventing the wheel. jQuery and such frameworks have a place because they abstract a lot of conditional statements to handle different browser quirks away from you. The framework supports certain browsers and for the most part you can expect that the behavior will be relatively consistent across those browsers.

Meanwhile I can’t even get consistent event firing order between IE, Edge, and Chrome for key and mouse events on inputs.


when I look at most pages, the most resource hogging use of JavaScript is usually the ads. Frameworks are at least shared between pages and cached but the ads just keep coming and optimization is not their aim.


This article is great. I am honestly surprised that more articles on this topic were not written 2-4 years ago (maybe there were some but I missed them). JavaScript-heavy single page web apps have been around for a while now and JavaScript performance must have been a serious concern for a lot of those applications.


"For mobile, aim for a JS budget of < 170KB minified/compressed. Uncompressed this is still ~0.7MB of code."

Almost a meg of code is a target to "aim" for? Please burn the DOM to the ground now, thank you.


If js cannot properly run on a smartphone or other limited devices, it should not be used anywhere.

If you don't understand how v8 works, don't use js.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: