Measuring the memory usage of popular web apps
github.com
github.com
Twenty five what? Megabytes? Mebibytes? Percent? Libraries of Congress? Furlongs per fortnight? Inverse femtobarns?
I can guess you mean "MiB" (mebibytes) from the charts, but units are always important. Bare numbers leads to confusion! It's good practice to always include units, even if it's a simple "All numbers are in MiB" at the top.
So Google Inbox actually uses 225.4447 MB
This is what comes of caring about performance and memory footprint. It doesn’t hurt also that almost all of it has been done by one guy rather than having fifty or more people all adding, adding, adding in uncontrolled fashion.
And Topicbox, our group email (mailing lists) product, is using 7–8MB for browsing archives. (It’s definitely simpler than FastMail.)
Somehow, large teams like Gmail’s, which have vastly more resources than us, are never good at memory usage, and seldom good at performance. I have some vague ideas about why this is, but it’s initially quite counterintuitive. It does seem to be a fairly consistent observation, though: small teams actually have a big advantage in such matters.
I’m almost sad that this was all under control before I started working at FastMail early last year, because it’s hard to justify improving it further, and I do find optimising things like memory usage and running performance to be such fun. (I know of a couple of ways memory usage and startup performance could made reduced; but the main thing for startup performance will be service workers and a persistent data cache.)
Meanwhile, I often have to interact with a Jenkins instance with a plugin that has a habit of redrawing a large table from scratch every second or two when a build is running, and keeping a reference to the orphaned DOM node. It can consume almost a gigabyte an hour.
Gmail vintage (0.8 MiB) -> Gmail (158 MiB) -> Inbox (215 MiB)
I feel a desire to switch back to the original HTML version - credit to Google for keeping it going. Here's the handy support page [0] with a link to convert back.
Edit: it appears you just need the `/h` appended to the URL [1]
I've read lately Inbox is probably going away after the recent gmail redesign which is incorporating some of Inbox's features.
It wasn't necessarily "fast" compared to a native client but was optimized enough to run in slow browsers.
And with crazy optimizations too. IE6 has bad memory performance for for-in loops. So instead it implement custom key-value structures https://github.com/google/closure-library/blob/master/closur...
E.g., if you load and decode a 3MB MP3 with the Web Audio API you can easily find yourself swallowing 30MB of RAM, depending upon the uncompressed sample rate. Another example: image decompression can lead to large amounts of GPU memory being swallowed.
You can see the effect of situations like this by using Chrome Task Manager, which will give you a more realistic view of total memory usage by a page.
I think overall this list is a good indication of sites that have respect for their users.
That's almost certainly a bug on your end. You do have 50MB of free RAM available, right? Other than actually running out of memory (and swap), normal usage should never result in a no-render.
My best guess would be a content blocker interfering.
It could be a score based on asset sizes, memory impact, cpu impact, etc.
By making it visible, people would be more cognizant of which sites have poor experiences or have a big impact on their computer.
The resources a 'web app' 'should' use is highly context dependent. As a web developer, I can determine some of that context, as I know what functionality is resource intensive. I don't think that you can distill that down in any useful way.
Compute this from the start of page load. Adjust the scale of the final output if desired.
# automatically scaled to local hardware
# in units the user actually experiences
t := "total wall-clock CPU time used (in ms)"
# yes, allocations - NOT total usage
m := "Total heap allocations (in kB/kiB)"
# magnitude of about:blank
a := typical_m_for("about:blank") *
typical_t_for("about:blank")
# score is computed similar to decibel
score := 10 * log10( (m * t) / a )
A variant of the score that excludes media data in <audio> or <video> tags should also be computed. Both versions should be presented.Continuously update these numbers, so the user can see the impact of any background JS/etc.
> utterly meaningless to all but the biggest nerds
Please don't assume people are stupid. If you give people real data consistently and it affects their life, they will figure out how to use it. Their interpretation may not be technically rigorous, but it will mean something to them. Also, most people will understand and expect the score for youtube to be (much) larger than a messaging service like twitter and both larger than a simple static text-only page.
> as I know what functionality is resource intensive
You only know this an isolated abstract sense. You do NOT know how much network bandwidth, CPU time, or RAM the user actually has available and wishes to use for you page. They may be using their bandwidth for other important things on another computer. Their RAM an CPU might be needed for other uses - inside or outside the browser.
Approximately nobody only uses one application at a time. Your app or webpage is almost always going to be competing for resources in an environment you do not control and can never truly understand (you do not know the user's ultimate goals, environment, or requirements/restrictions).
You can't simplify this problem down to "This uses more RAM than an arbitrary threshold therefore it's a problem." If I spend 99% of my time using an app then I want it to cache hundreds of megabytes of data in to memory so I can work fast. Saying it's a bad experience if it does that is wrong.
I'd add to it the slider "cache this app more-less", because you know how do you usually use this app or page.
And the "complain" button with auto-redirect to some support, or uservoice form of this app, if there is any, when e.g. I moved the slider to the "less" as possible and even then it still eats 200 megabytes of RAM.
Gmail is still using an estimated 80MB for what FastMail needs only 11MB for.
Where is this 80MB coming from? Is it caching 80MB of emails? I think not. You’ll be lucky if that 80MB corresponds to even half a megabyte of email.
Most high memory usage is not because it’s caching things so it can work fast. Most high memory usage is simply because the app is inefficient.
They don't care because it's not a problem for them. Yeah, maybe they could have bought a cheaper phone if everyone had spend twice as much time writing the code. But hardware advances have actually caught up with requirements (and then some), and all these sites work fine on even lower-end current phones.
You care about it like a watchmaker cares about the mechanical drive of his watch.
They don't need a watch. They have smartphone. It's 8 magnitudes more precise than your mechanical watch.
It's just regular users know so little about technology that they accept what they're given without any question. "Thinks work slow so it's definitely the fault of my computer, maybe it has viruses".
I wish I knew how much each site/domain was costing me. Then I could have a better idea which sites are profligate wastrels to be avoided and which sites I can feel free to visit at will.
I wonder how much of the bloat comes from everyone using React/Angular/Polymer/Bootstrap and the layers and layers of libraries and another DOM and rendering engine.
I don't think React is the problem.
90% of the time I use it via IMAP, quite snappy indeed.
E.g. I see the Okta authentication extension (which is a required part of work setup) spending nearly a hundred megs after prolonged usage in Firefox. Mong other things, it appears to allocate a lot of identical strings (like 500M of them), likely by a thoughtless `substring` call somewhere.
1. Was the cache emptied before each test? (A lot of these sites would share scripts on CDNs)
2. What Firefox addons were enabled? (README says that uBlock was active, so that definitely has an effect)
It's the attitude of if it works who cares how much memory it uses.
Or when I bring up allocations in something like .net, I get don't worry about it .NET GC will sort it out eventually.
Modern developers....
Certainly at the add-on level, as I presume this is how https://addons.mozilla.org/en-GB/firefox/addon/tab-memory-us... is implemented.
If feeding this back to use as a general performance metric, you would have to be very careful to make sure you were measuring the same thing each time which for a complex application could be difficult unless you are only measuring on initial page load (which might not be as useful as you are hoping for). Without this control you would need a lot of results to make any average or other analysis of the metric meaningful.
For controlled tests run by yourself in dev (rather than a performance metric for your app in production) it could be useful though.
https://old.reddit.com/, 13.70MB (1MB of scripts, 1MB of other, 2MB of objects, 6MB of DOM nodes, 782KB of strings).
Software is built on layers of abstraction[0], and necessarily, there will be bloat as a byproduct of layering. If we had to map out complexity of what's really going on in a typical computer, the "bloat" floating at the top layer caused by JavaScript would be put to shame by the complexity in the underlying browser and the OS underneath that, all of which arguably are too "bloated" for 90% of daily use.
Of course, it's rather difficult to go back in time to measure the old interface now.
There's got to be a special name for this kind of logical fallacy.
> Software is built on layers of abstraction, and necessarily, there will be bloat as a byproduct of layering.
Except we're layering less powerful, less abstracted APIs over an already high-level document model, or we're layering a primitive record access API over SQL.
Similar to https://en.m.wikipedia.org/wiki/Just-world_hypothesis perhaps?
There also needs to be a Fallacy fallacy: the irrational believe that merely dropping the "fallacy" moniker is an argument.
In this case: Yes, considering there are many hosted email services competing for customers, with quite a lot of variation between "huge web app" and "minimalistic list of links". And considering Google is known to excessively A/B test any change (including more-complex v. just-html interfaces), it's quite valid to conclude that people generally prefer what GMail is doing.
GMail even has a fallback html interface it switches to when noticing slowdowns. The number of people keeping that mode on manually (few) is another indicator of people's preferences.
> Except we're layering less powerful, less abstracted APIs over an already high-level document model[...]
"Abstract" != "good". Abstraction layers can be stupid, or deliberately constricted. They are still, tautologically, by definition, one step more "abstract" than the API they access.
Voting-with-your-wallet fallacy?
Users choose from what's available on the market. Between high marketing, network effects and lack of technical understanding of the average user, there is close to zero feedback going back to service providers. The providers get to unilaterally decide what's on the market, and users have no choice but to take it.
[0] https://addons.mozilla.org/en-US/firefox/addon/twitch_5/?src...
Should you have to pay the price for that? Probably not. I like the you have a way to avoid the things you don't need and save memory and time.
Such as? (genuinely curious)