Everyone blames bloated web pages on the browser

2
Official Construct Team Post
Ashley's avatar
Ashley
  • 12 Apr, 2017
  • 676 words
  • ~3-4 mins
  • 2,312 visits
  • 0 favourites

Recently I read this critique of Slack's desktop app, which is built with Electron (basically a Chromium-based wrapper like NW.js). In other words, it's a browser engine plus the app.

The author notes the Slack app using 5% CPU while idle (much more in some cases), and between 300mb-1GB RAM. They wonder what on earth must be happening. And who gets the blame?

"And chrome is a hog. Its huge and complicated. It uses ram and CPU like nobody's business, and it totally thrashes your battery life."

As a comparison, I thought I'd run Construct 3 — an entire game development IDE we recently released — and open one of the demo projects (Space Blaster), and see how it compares to the author's numbers for Slack, an instant messaging client. We've engineered Construct 3 to be as efficient and lightweight as possible, given the scope of the app.

According to my measurements, Construct 3 with a whole game project opened and showing, uses about 290mb RAM and left idle the CPU remains a satisfyingly dead 0%. By the way I tested with a 4K display, so that includes hi-res graphics, including a full WebGL 2 context.

Then there's the TechCrunch homepage uses over 500mb RAM and the CPU on my 8-thread machine idles at around 15-20% audibly spinning up my laptop's fans as it tries to cope with multiple simultaneous video streams. So we built an entire game development IDE that is far less demanding than a typical web page.

Typical web content is incredibly bloated and inefficient. Rather than blame the bloated web content, everyone seems to blame the browser instead. Even technical people do this, as the blog post in question was very highly voted on the programmer-centric Hacker News.

One of our goals in developing Construct 3 was to show what's possible when web content is done right. In fact it can start up with just 1mb of content download — half the size of the average website today, and a fraction of the 60mb download for the full installer of our previous native desktop app. It's obviously not the browsers that are that inefficient. It's the bloated web content. Unfortunately everyone blames the browser for doing what it was told by the developer. It's like blaming Windows if iTunes is slow and uses a lot of memory. Why blame the platform for a poor application?

The author also bemoans the size on disk and inefficiency of running multiple browser instances. Well then, don't. Just run it in the browser. You're already running a browser to read this. Slack has a web interface. It won't necessarily be any more efficient if it's the same content, but you can use it literally right now with your existing, pre-downloaded browser engine. That's our solution with Construct 3 as well: it's a Progressive Web App (PWA) that can do almost everything without needing to be downloaded. You can even use the "Add to homescreen" or "Add to desktop" option in Chrome to get an app-like experience, without any extra download at all. Our goal is to do the maximum possible to make a downloaded app redundant.

In the past, web pages were "just" documents, which are intuitively lightweight in computing terms. However we really have reached the point where a typical web page is far more demanding than even a large and complex productivity app. This is the reverse of the intuition; now web pages are heavyweight media-intense interactive experiences, and an app can be significantly more lightweight. I think the tech community hasn't caught up with this new reality. Maybe that's why people blame the browser: we just can't quite believe this really has happened, that a modern document could be more demanding than a full IDE.

So we should stop blaming bloated pages on the browser. Chrome is an incredibly well-engineered browser, and no, you don't have to download copies of it. It's the web content that's the problem. And that can be made very efficiently too. We should probably focus on that instead.

Subscribe

Get emailed when there are new posts!