Hacker News new | ask | show | jobs
by Mavrik 5188 days ago
I'm just hoping slimming down memory usage won't go at the expense of speed... my systems have 16GB of RAM - I want Firefox to use as much memory as possible to speed up my experience. So if slimming down FF will make my disk trash more, that's the wrong direction to take.
5 comments

> So if slimming down FF will make my disk trash more, > that's the wrong direction to take.

We explicitly don't want to cause this.

When we reduce the number of nodes in the live object graph, our garbage collector and cycle collector run faster. This results in shorter stop-the-world pauses when we collect.

This isn't the only thing we've done as part of MemShrink, of course, but it's an example of how reducing memory usage and running faster aren't always at odds with each other.

I'll repost nnethercote's article on the consequences of memory reductions, it's a classic: https://blog.mozilla.com/nnethercote/2012/02/08/the-benefits...
Yes, one thing I notice is that when I have a tab with a lot of images in it, and I switch to another tab, browse a little and switch back, I have to wait for the images to 'reload'. I guess it stores them compressed in memory and they have to be decompressed again. I have memory to spare and sometimes it does this when I'm quickly switching tabs for comparing something for example. This is annoying.

I'm also one of those users that leaves 100's of tabs open in the background, and sometimes I think they, or javascript (userscripts?) in them keep using CPU somehow, and it slows down everything. It would be cool if firefox could set a low CPU priority to these tabs, or freeze them if possible, ala BarTab extension.

On Linux at least, the rest of your RAM will be used by the page cache which does a lot to make disk access efficient, and as much as possible bypassed entirely.
Yep. In other words, using more memory in user space is a sure way of slowding down the system. Specifically PostgreSQL is easily impacted by that as it keeps as little memory for itself as possible and delegates everything it can to the OS.
From https://wiki.mozilla.org/Performance/MemShrink: "Changes that reduce memory consumption but make Firefox slower are not desirable."
In an age when most computers come with 4+ GB of RAM, I think people focus too much on memory. Of course there are older computers, but their OS should be using comparably less RAM. WinXP takes up 100 MB at login, so if you only have 1 GB on an older computer, you should still have no problem running modern Firefox. And if you only have 512 MB, it's probably time to upgrade since the web experience that a modern browser can offer you will be crippled by your old hardware.

A few months ago I had a conversation with somebody who complained that Firefox used too much memory (about 600 MB). I asked how much he had. He said 3 GB. That seemed more than enough to me, after all Gnome consumes 200-500 MB at login, depending on whether you're using 32 or 64 bit and which shell you're running (Gnome 2, Gnome Shell, Unity, etc). Turns out, Win7 was eating 2 GB at login, leaving him with only a gigabyte for other programs.

In my view, the operating system is just a platform to launch other stuff. It shouldn't use more than 25% of your memory. If it does, you should either get more RAM or slim down your OS. If his computer obeyed my rubric, he'd have plenty of room for Firefox. His anger was obviously directed at the wrong problem, but for some reason the OS (and all the crapware which loads at boot and runs in the background, even when it's not needed, consuming precious resources) gets a pass.

But why do our computers have to come with 4GB+ of RAM, when 1GB might suffice? It's an circular argument to claim that it's OK to use lots of RAM simply because the computer comes with lots of RAM.

After a manufacturer begrudgingly provides the RAM that developers refuse to conserve, we shouldn't then use the presence of this additional RAM to use even more.

Your friend's anger at application waste is justified. Witness new devices like the iPad that survive with much less RAM than a desktop -- just 512MB, which happens to be enough to support an excellent browser.

Are you kidding about the iPad? It definitely suffers from lack of RAM. Almost every time you change tabs, it has to reload the page.
We use that memory because we do more things faster. Of course we could page to disk whenever we want to use more than 1GB of memory, or render from CPU instead of keeping uncompressed versions in memory to lower footprint... Or we could have faster computers. Consumers prefer the faster computer option.
Sure, using more RAM to make things faster is a fine thing. But I think you give developers too much credit: many apps use lots of RAM for no other reason than lack of care.

Which of course can also be to the benefit of consumers: better a RAM-hogging release today than a memory-efficient release next month (if ever).

Memory consumption is important because it has a significant effect on performance and crash rate. The effects vary greatly depending on your hardware. You're right that people focus too much on raw memory measurements themselves. There are many time/space trade-offs.
I don't think Win7 alone can account for 2 GB at login, even with SuperFetch.

There were probably a few programs that run on startup (antivirus, IM, OEM-specific crapware if it's a laptop, "speed launchers" like adobe reader, updaters)

I installed a new Win7 partition last week. Yep, almost exactly 2GB memory usage at start. This was a clean Win7 Pro, no third-party crapware installed.