Closed Bug 1368665 Opened 7 years ago Closed 7 years ago

stylo: Consider sorting the class list in the style sharing cache.

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: emilio, Assigned: bholley)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We are comparing class names in order right now. This was suggested by Bobby in https://github.com/servo/servo/pull/17063, but I didn't do it there. I think we should have some numbers before doing it, because I don't think it's common at all, and I don't think sorting is as cheap as Bobby suggests.
(In reply to Emilio Cobos Álvarez [:emilio] from comment #0) > We are comparing class names in order right now. > > This was suggested by Bobby in https://github.com/servo/servo/pull/17063, > but I didn't do it there. > > I think we should have some numbers before doing it, because I don't think > it's common at all What numbers, exactly? It seems entirely dependent on whether the page ever uses multiple orderings of the same class list, which is something that can easily occur with dynamic scripts that .toggle() classes, but that would non-trivial to measure for the entire web, especially given the dynamic part. > I don't think sorting is as cheap as Bobby suggests. Can you explain why? Sorting small lists happens in-place, and is very cheap as far as I can tell from the stdlib source. I'm totally happy to limit the sort to class lists of <= 5 or so if you're worried about pessimal cases of thousands of classes.
Assignee: nobody → bobbyholley
MozReview-Commit-ID: 3vsfP5ECzds
Attachment #8872723 - Flags: review?(emilio+bugs)
Attachment #8872723 - Flags: review?(emilio+bugs) → review+
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: