Skip Navigation

One company found that too much JavaScript costs them $700,000 per year, per kilobyte.

thenewstack.io Too Much JavaScript? Why the Frontend Needs to Build Better

One company found that too much JavaScript costs them $700,000 per year, per kilobyte. Here's what Alex Russell says needs to change.

Too Much JavaScript? Why the Frontend Needs to Build Better
39

You're viewing a single thread.

39 comments
  • Nearly everything done nowadays with 500MB+ of javascript libraries could already be done more than a decade ago with jQuery + AJAX.

    • I'm not a big subscriber to this notion. After working in both of the technologies (and more), and React/Vue is a significant boost in developer productivity compared to jQuery and AJAX. More features, less bugs, a more app-like web experience. Not to mention things like Native or Electron potentially saving on the cost of entirely separate apps.

      Further, the resulting assets can be even smaller after minification and bundling as long as you aren't creating one giant blob that gets shipped on every minor, unrelated change and includes all the dependencies and source maps and assets – it's important to remember many bundlers include media files – on production.

      I think there's numerous opportunities for improvement to be had (diff-based updates, semver-aware CDN, smarter defaults, more leveraging of things like WebASM and improvement on the standards), for sure, but talk of "the good ole day" of jQuery certainly seems rose-tinted given how much of a mess it was in practice (for me, of course).

      • Let me quote myself:

        Nearly everything done nowadays (...) could already be done more than a decade ago with jQuery + AJAX

        I dunno where or why you thought I put on nostalgia glasses and began to remiss the good old days. I stated a simple fact, at least about about web pages. I'm indifferent to jQuery and absolutely despise AJAX, it really was a complete mess.

        Electron is just Chrome bundled with a self hosted NPM server. If the intent is to write JS once and deliver everywhere, Neutralino and TauriJS are much better alternatives. The real irony is that it's not hard to find stuff (mostly games) packaged in Electron, but distributed only for one OS, completely negating the main selling point.

        WebAssembly is one of the strangest things to ever grace us, when you think about it. Javascript is too slow, thus, in order to have faster apps, let's make browsers capable of dealing with WebASM. So, in order to make bloated software work better, add more bloat? Oh, sorry, "feature". Layers and layers and layers of extremly situational features, because we're too lazy to come up with/use more efficient ways of making stuff crossplatform.

          1. Sorry if it was an assumption, I was speaking to the context you posted.
          2. I'm not discriminating between the specific abstraction layer. Anything that provides an HTML canvas, CSS, and JS is fine. But, at least with Electron, you can fine-tune things down really well with the use of native code and an API less constrained than the web standards. This is why VS Code is quite the snappy fella.
          3. Cross-platform is Electron's second selling point, really. The first is the ability to create desktop apps using the fun JS web frameworks rather than learning Java, C#, or C++ and having to use the unpleasant UI frameworks they have - like QT. Clearly that's the case for all the folk who only support one platform, at least.
          4. WebAssembly doesn't seem weird to me at all? The web is a great way of distributing end-user software but can suffer from performance and control issues in the case of heavier applications. Web assembly is the logical conclusion that allows us to leverage the browser's crazy powerful and optimized DOM, JS runtime, and layout engines, while having a super fast layer with a low interop cost to do that heavy work. Especially as they move towards gaming support via WebGL. Furthermore, it provides a sandboxed runtime with privilege control that downloading binaries from Itch simply can't. It has a real purpose. Albeit, I again agree it's execution has some issues.

          All this just to say: I think the common denigration of this tech (not specifically your comment, since you clarified) is a cynical take that ignores important economic factors. Modern web development is flawed, but the direction it has moved is still forward.

          Anyway, hope you have a good day!

39 comments