Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse the information of Document::idmap for selector matching #3314
Comments
|
i take it, please |
|
I imagine how this would help selectors API (where for a selector and a document we find elements), but not for stylesheets (where for a given element we find style rules that match). @saneyuki, do you know how it’s used in other browsers? @JIoJIaJIu, line 665 now is in the middle of |
|
That link was to the |
|
thank you for tip @SimonSapin servo/components/script/dom/document.rs Line 843 in 154427c |
|
Other browsers use the Gecko & Blink have some fast path. but I feel their path are primitive. WebKit does the most aggressive optimization for selector matching including about id selector. I don't know how much of their path is used from non-JIT one now and how we can implement some of them without JIT approach... Gecko
BlinkWebKit
And I heard from @Constellation that WebKit used to have non-JIT fast path more but they removed them because Selector JIT beat non-JIT fast path. |
We have the table to cache the position of all id-ed elements in DOM Tree as
Document::idmap.In other browsers, they also have same information and use it for optimize ID selector matching.
So we should use it.