Closed Bug 934788 Opened 6 years ago Closed 6 years ago

Faster selector matching for attribute selectors by not counting the number of attributes

Categories

(Core :: CSS Parsing and Computation, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: smaug, Assigned: smaug)

References

Details

(Whiteboard: [qa-])

Attachments

(2 files)

Attached patch patchSplinter Review
Currently SelectorMatches uses GetAttrCount and (safe) GetAttrNameAt to iterate
over all the attributes. Use of the latter should be enough, and we can add
a fast HasAttrs to Element.

We may want to add a faster way to get attr count, but it just shouldn't be
needed at all here.

Seems to help a % or two with bug 917247.

(Other things we could perhaps fix is GetAttr usage and string copying/addrefing,
few % could be optimized there)

https://tbpl.mozilla.org/?tree=Try&rev=6abee7f8a9d1
Attachment #827140 - Flags: review?(bzbarsky)
Comment on attachment 827140 [details] [diff] [review]
patch

>+    return MappedAttrCount() || (AttrSlotCount() && mImpl->mBuffer[0]);

I'd prefer AttrSlotIsTaken(0) for that last check; it's clearer as to what's really going on and why it's safe.

r=me with that
Attachment #827140 - Flags: review?(bzbarsky) → review+
Attached patch patchSplinter Review
https://hg.mozilla.org/mozilla-central/rev/d1ea27ce8789
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.