Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

queryAll optimization #30

Closed
dy opened this issue Mar 25, 2020 · 1 comment
Closed

queryAll optimization #30

dy opened this issue Mar 25, 2020 · 1 comment

Comments

@dy
Copy link

dy commented Mar 25, 2020

queryAll can do better than https://github.com/josh/selector-set/blob/master/selector-set.next.js#L377:
instead of selecting all elements matching all rules in context, individual selectors may have up to 25 times better performance via getElementsBy*, which is O(c) - compared to best-case querySelectorAll O(n).
For some cases that can reduce queryAll complexity from O(rules * nodes) to O(rules * c).

@josh
Copy link
Owner

josh commented Apr 21, 2020

I did originally try that approach years and years ago when this was originally authored. But the compound selector did perform better. That said, browser engines have changed a lot since then so things may have changed.

This project is basically in maintenance mode after 6 years. I can't commit to making big algorithm changes at this point without a lot of testing.

Thanks,
Josh

@josh josh closed this as completed Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants