Speed up shared/node-attribute-parser parseAttribute function
Categories
(DevTools :: Inspector, task, P3)
Tracking
(firefox70 fixed)
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
Details
Attachments
(1 file)
From profiling the inspector on a node with lots of attributes, I could see there was a non-negligible time spent in parseAttribute
function.
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
hasAttribute
and getAttribute
were using for..of loop to
get what they wanted, which wasn't ideal.
Moreover, most of those operations were happening because we
didn't pass the attribute value to the parseAttribute function,
only an array of all the attributes. This is a bit unfortunate
there's only one place where we call the parseAttribute function,
and there, we have easy access to the attribute value.
This patch removes direct calls to hasAttribute and getAttribute.
hasAttribute is removed, but we need to keep getAttribute for the
isValid function in parsers.
We add an attributeValue
parameter to the parseAttribute function.
The unit test for this function is also modified to pass the attribute
value.
perfherder reports a ~2.5% improvement on custom open and ~3% on
custom reload.
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/42ca111a8189 Enhance performance on parseAttribute function. r=gl.
Comment 3•5 years ago
|
||
bugherder |
Description
•