Closed Bug 1564480 Opened 5 years ago Closed 5 years ago

Speed up shared/node-attribute-parser parseAttribute function

Categories

(DevTools :: Inspector, task, P3)

task

Tracking

(firefox70 fixed)

RESOLVED FIXED
Firefox 70
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.

See Also: → 1556255
Priority: -- → P3

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.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: