Closed Bug 208727 Opened 21 years ago Closed 13 years ago

consider removing Declaration::mOrder

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dbaron, Unassigned)

References

Details

(Keywords: memory-footprint, perf, Whiteboard: [MemShrink:P3])

On bug 107270 and bug 125246 there was some discussion of whether we should
bother with nsCSSDeclaration::mOrder.  The CSSOM doesn't require it, and it's
mainly just bloat.  However, Daniel has mentioned that he would like to have it
around for editing (perhaps optionally?).
Could we at least not maintain this array during DOM manipulation of style, when
it's not really meaningful anyway?  Doing that is about 1% of total time on
DHTML testcases with lots of objects being animated (for comparison, all of
reflow is about 6%).
Blocks: 203448
Keywords: footprint, perf
Preserving style declaration orders matters in an editor, since we serialize the
STYLE attribute from the CSSOM. So if foo.style.backgroundColor="red" preserves
the order instead of putting "background-color: red" at the end, that's fine:-)
I filed bug 288574 on that thought.
Assignee: dbaron → nobody
QA Contact: ian → style-system
it'd be great if we can remove this, since we create about 8000 of these things starting the browser and loading gmail. and the nsCSSDeclaration::ValueAppended() codepath gets hit about 50,000 times.

filed bug 410357 to use nsAutoTArray and avoid most of the allocations.
Whiteboard: [MemShrink]
Summary: consider removing nsCSSDeclaration::mOrder → consider removing Declaration::mOrder
dbaron, bz: is mOrder still needed?
Whiteboard: [MemShrink] → [MemShrink:P3]
I think it's definitely still needed for anyone building editing tools on top of Gecko.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
Some data:  after starting Firefox and loading Gmail I get almost 9500 Declarations.  The sizes of the array storage have this distribution:

( 1)   6706 (70.8%, 70.8%): size=0
( 2)   2003 (21.2%, 92.0%): size=40
( 3)    683 ( 7.2%, 99.2%): size=72
( 4)     71 ( 0.7%,100.0%): size=136
( 5)      3 ( 0.0%,100.0%): size=56
( 6)      1 ( 0.0%,100.0%): size=88

That's 139KB for the array storage.  If we add the actual nsAutoTArrays themselves (within the Declaration object), that's probably another 16 bytes per array, which would be another 150KB or so.  Non-trivial!
(In reply to David Baron [:dbaron] from comment #6)

> I think it's definitely still needed for anyone building editing tools on
> top of Gecko.

Yes. The side-effects of a removal on all online editing tools relying more
and more on CSS became unpredictable. It was a bit different years ago when this
bug was filed.
You need to log in before you can comment on or make changes to this bug.