Open
Bug 922554
Opened 11 years ago
Updated 1 year ago
removeAttribute("id") much slower than in Chrome and Safari
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
NEW
People
(Reporter: jandem, Unassigned)
References
Details
Attachments
(1 file)
250 bytes,
text/html
|
Details |
I'm attaching a testcase that does just: for (var i = 0; i < 18000; i++) { body.id = "foo"; body.removeAttribute("id"); } Safari 6.0.5: 6 ms Chrome 31: 8 ms Nightly 27: 80 ms Why is Webkit > 10x faster? Can we do something similar? jQuery does setAttribute/removeAttribute, see bug 922053 comment 2.
(sounds like rather silly test.) nsIMutationObserver notifications take a lot of time, up to 40%, and the time is mostly spent somewhere in layout and style. RestyleManager::AttributeWillChange and and RestyleManager::AttributeChanged. Could we cache the return value of HasAttributeDependentStyle
Component: DOM: Core & HTML → Layout
![]() |
||
Comment 2•11 years ago
|
||
Jan, WebKit mostly gets this fast at the expense of some CSS bugs and some extra time spent doing CSS processing later, last I checked.... We can certainly make the microbenchmark case of AttributeWillChange/AttributeChanged faster, though: we should have a single object that handles it, instead of virtual function calls across 5-6 objects. So basically, have the various rule processors tell some other object about all their attribute dependencies and have DOM query that object.
![]() |
||
Comment 3•6 years ago
|
||
When I try the testcase from comment 0 on nightly, Safari Tech Preview, and Chrome dev, I get: Safari: ~10ms Chrome: ~10ms Nightly: ~17ms So we're not quite at parity yet, but we're a lot closer...
![]() |
||
Comment 4•6 years ago
|
||
https://perfht.ml/2GXFJIZ is a profile of the testcase with the iteration count bumped. Lots of thrashing of hashtables (the atom table and that id table most obviously). Lots of atom refcounting. Not much else jumping out at me....
Updated•2 years ago
|
Severity: normal → S3
Updated•1 year ago
|
Component: Layout → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•