On 1/6/10 6:03 PM, L. David Baron wrote:
That leaves mNthIndices. As a first cut we could just not cache
Maybe we could cache (somewhere?) the indices for the two elements
that needed them most recently? That would let us do prev-sibling
optimizations and node-matches-multiple-selectors optimizations.
I thought about it some more, and it _sort_ of does. It doesn't for the
querySelector(":nth-child()") case, because you would match a node, then
all its kids (thrashing your index cache) and only _then_ its next sibling.
For normal style computation (from frame construction) it would work a
bit better, since we do all the kids one after the other building our
frame construction item list, except for inline kids (where we descend
into all inline descendants).
I'll still do it and see how it goes. In practice, the most common use
of these is likely to be for table rows and such, where the "normal
style computation" case would be hit. The most likely querySelector
issue, I suspect, is benchmarks and not production code. And the
benchmarks use DOMs that are small enough that the caching is not that
relevant, I suspect. I'll have to check.
-Boris
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout