Live data from Hacker News

Firefox fixes save gigabytes of memory on image-heavy pages

blog.mozilla.org

11–20 of 203 posts

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#11
post #9

Earlier quoted context omitted.

Gee, the trolls are up early today...

On one hand true, on the other - it isn't that those fixes are some magic, extra smart hackery (at least on the idea level, dunno about the implementation). Don't load an image that user don't see, remove an image that user saw but don't see anymore - those seem as rather obvious solutions.

Obvious, but tricky. Take a look at the bug: https://bugzilla.mozilla.org/show_bug.cgi?id=847223

It comes in ten parts, and there's lots of discussion about how to deal with viewports, when to load things in, etc.

The original bug (which discarded images that weren't visible) was even worse: https://bugzilla.mozilla.org/show_bug.cgi?id=689623

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#14
post #9

Earlier quoted context omitted.

Gee, the trolls are up early today...

On one hand true, on the other - it isn't that those fixes are some magic, extra smart hackery (at least on the idea level, dunno about the implementation). Don't load an image that user don't see, remove an image that user saw but don't see anymore - those seem as rather obvious solutions.

Yeah the original comment isn't all that wrong technically (though not very nice either). Firefox is my main browser but loading long and heavy pages takes noticeably longer than with Chrome or IE and causes laggy scrolling. Glad they fixed it with v26 though, hopefully should land in the beta channel soon.

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#15
post #9

Earlier quoted context omitted.

On one hand true, on the other - it isn't that those fixes are some magic, extra smart hackery (at least on the idea level, dunno about the implementation). Don't load an image that user don't see, remove an image that user saw but don't see anymore - those seem as rather obvious solutions.

Yeah, and to cure cancer you just need to eliminate the bad cells without affecting the good cells. It's obvious.

Except, selectively targeting (bad) cells in a heavily complex system (physiology) that you didn't design and have limited access to makes it tough.

Implementing these fixes in FF is easy. They didn't even have to be geniuses to realize it, just keeping an eye on friends (/rivals) would have given them the idea a few years ago.

NB: Not criticizing FF devs. They do awesome work! And sometimes, such silly little optimizations can just stay hidden at the back of everyone's minds for ages until showing themselves through a veil of obviousness.

But, cancer vs these optimizations? No chance.

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#16

Earlier quoted context omitted.

Yeah, and to cure cancer you just need to eliminate the bad cells without affecting the good cells. It's obvious.

Except, selectively targeting (bad) cells in a heavily complex system (physiology) that you didn't design and have limited access to makes it tough. Implementing these fixes in FF is easy. They didn't even have to be geniuses to realize it, just keeping an eye on friends (/rivals) would have given them the idea a few years ago. NB: Not criticizing FF devs. They do awesome work! And sometimes, such silly little optimi…

The idea of fixing them is easy, the practicalities are clearly not - take a look at the size of the bug reports and patches that go with them...

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#17
> When loading the page, physical memory consumption would still jump to almost 3 GB, because the images are still decoded. But it would soon drop down to a few hundred MB, as the decoded data for non-visible images was discarded, and stay there (with some minor variations) while scrolling around the page.

This is a great news. The application that uses the most memory on my machine is the web browser.

I wonder if this fix would make scrolling the page less smooth.

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#18
post #7

I wish people would use regular 2d plots for 2d data. Other than that, great news!

Technically it's 3D data, with the three axes being {Time, Memory Usage, Version}. But I agree there may be a better way of visualising this data.

Technically it's three trials of 2D data, with the axes being Time and Memory Usage. The width of the lines given by the version axis is for visibility, not to encode data.

A 2D line graph with 3 colors for the different versions would be an appropriate visualization. This one suffers spatial distortion and is only useful in confirming that yes, they use less memory in step 2 now.

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#19
Like many of the other Firefox memory changes, this one leaves me feeling a little ambiguous. On the one hand, obviously keeping memory usage down is good. On the other hand, waiting to decompress/decode images until they are visible to the user means that there are obviously going to be performance trade-offs (and also, obviously, design/engineering trade-offs).

Speaking just from my personal usage: I don't think there has ever been a time where delaying the image decompression on a page would ever have had any utility for me (at least from a memory standpoint). On the other hand, there have been plenty of times when eagerly performing image decompression would make my browsing a bit smoother.

All in all, it seems (from a not-particularly-in-touch outsider perspective) as if Mozilla went from being totally dismissive of memory complaints to being hyper-responsive to memory complaints with no (publicly stated) rationale behind the change. It would be interesting to see the reasoning behind this (if only from an intellectual standpoint), particularly given that in many cases I tend to feel that it would have been better to simply be a bit more diplomatic when rejecting memory-based bug reports.

Re: Firefox fixes save gigabytes of memory on image-heavy pages

#20
I just compared it with Chrome using the example page mentioned in article:

In Firefox Nightly at the initial page load it uses around 250 MB memory and with scrolling it stays around that.

In Chrome (in Canary too) initial it uses around 300 MB but scrolling keeps filling the memory indefinitely (I stopped scrolling above 1.2GB)

Post reply on HN