Improve memory usage with many similar tabs opened

RESOLVED WONTFIX

Status

()

Core
JavaScript Engine
RESOLVED WONTFIX
6 years ago
4 years ago

People

(Reporter: marco, Unassigned)

Tracking

15 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [MemShrink][js:t])

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
I noticed high memory usage with many similar tabs opened.
For example, with many FB photos opened in different tabs:
483.98 MB (52.68%) -- (309 tiny) [with many tiny compartments using ~7 MB]
250.89 MB (27.31%) -- window-objects [with many entries using ~4 MB]

We could share something between these tabs, as they basically contain the same things.
And even if the mine isn't a common use case, this would also improve memory usage when the tabs aren't so much similar but contain, for example, the same JS libraries (that is pretty common). And probably would improve a lot GC and CC times (in the situation above, I continuously get ~500 ms GCs that take the form of visible pauses)

Is this feasible?

Updated

6 years ago
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
QA Contact: untriaged → general
Leaving this to MemShrink for now.
Whiteboard: [MemShrink] → [MemShrink][js:t]
Images are already shared.  Sharing layout/DOM stuff apparently isn't feasible.  Bug 679942 is open for the JS stuff that might be able to be shared.  I don't think there's much scope for sharing other stuff :/
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
(Reporter)

Comment 3

6 years ago
(In reply to Nicholas Nethercote [:njn] from comment #2)
> Images are already shared.  Sharing layout/DOM stuff apparently isn't
> feasible.  Bug 679942 is open for the JS stuff that might be able to be
> shared.  I don't think there's much scope for sharing other stuff :/

Great, I completely forgot bug 679942.
(Reporter)

Comment 4

5 years ago
Nicholas, what do you think about http://trac.webkit.org/changeset/115379 and http://trac.webkit.org/changeset/116235 ?
(In reply to Marco Castelluccio from comment #4)
> Nicholas, what do you think about http://trac.webkit.org/changeset/115379
> and http://trac.webkit.org/changeset/116235 ?

Nice idea, but I have no idea how Gecko's architecture compares to Webkit's w.r.t. CSS representation.  bz or dbaron might know more.
We already have copy-on-write sharable style sheets, though it might need some security auditing and/or improvement for sharing across pages.  We currently only share (a) via XUL prototypes (i.e., across instances of the same chrome XUL document) and (b) when a single page loads the same style sheet more than once.

There are also a bunch of even stronger things we could do for sharing between pages in the style code.  At some point I made a list (which included bug 385229 and a bunch of other things); I wish I remembered where.
Created attachment 650734 [details]
"More sharing in style code" thread from mozilla.dev.tech.layout

This thread has a bunch of ideas.
Comment on attachment 650734 [details]
"More sharing in style code" thread from mozilla.dev.tech.layout

While this is a message/rfc822 mailbox, I'm going to change the type to text/plain so people can actually look at it.
Attachment #650734 - Attachment mime type: message/rfc822 → text/plain
The WebKit changesets in comment 4 are roughly equivalent to item 1 in the email in comment 7.  The email in comment 7, however, goes up to 5.  It doesn't go to 11, though. :-)

Also, maybe we shouldn't be having this discussion in a WONTFIX bug?  I never got around to filing bugs on the items in that email...
I filed bug 904836 as a metabug to continue from comment 7.
You need to log in before you can comment on or make changes to this bug.