Closed Bug 1843949 Opened 1 year ago Closed 1 year ago

Consider pre-allocating the attribute array based on the known attribute count from the parser

Categories

(Core :: DOM: HTML Parser, task)

task

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(1 file)

Here's a profile of 33 iterations of the TodoMVC-jQuery subtest, focused on nsHtml5TreeOperation::SetHTMLElementAttributes: https://share.firefox.dev/3Dk2cvg

It shows some amount of time spent in AttrArray::GrowBy, suggesting that the attribute array might be grown and reallocated multiple times.

The parser knows the number of attributes it's going to add. I think it's worth pre-allocating the array to that known count.

I have a patch which does this; it doesn't help a huge amount on speedometer3 but it seems worth doing anyway.

This is basically bug 380802, but since this has a patch, marking that a dup of this one.

Duplicate of this bug: 380802
Attachment #9344301 - Attachment description: WIP: Bug 1843949 - Preallocate attribute array with the known size from parsing. → Bug 1843949 - Preallocate attribute array with the known size from parsing. r=emilio
Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/a1321f6af73b Preallocate attribute array with the known size from parsing. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: