Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potentially improved pseudo filter perf #254

Closed
bkardell opened this issue Mar 12, 2014 · 1 comment
Closed

Potentially improved pseudo filter perf #254

bkardell opened this issue Mar 12, 2014 · 1 comment

Comments

@bkardell
Copy link

Simple matchers are simple - known complexity. Filters are potentially substantially more complex. It makes sense to avoid calling them when possible. There are cases where filters are included as part of a compound selector[1] in which the simple selectors are leading. In this case it is functionally equivalent, but potentially much faster to test the filter only if the other simple selectors don't match. I explained this more on the forum[2], but, that's the gist and I don't know that anyone is actively watching this. I implemented and tested this in my fork[3] and it seems good, but I don't want to send a pull or think about taking it further without some feedback.

[1] http://dev.w3.org/csswg/selectors4/#compound
[2] http://forum.jquery.com/topic/matchers-and-pseudos
[3] https://github.com/bkardell/sizzle/blob/master/src/sizzle.js#L1749

@gibson042
Copy link
Member

Thanks very much for the feedback! We actually already have something similar in the works for Sizzle 2.0 (see https://github.com/jquery/sizzle/blob/2.0-WIP/src/sizzle.js#L1568 and https://github.com/jquery/sizzle/blob/2.0-WIP/src/sizzle.js#L43-L46), and would welcome your contributions to that branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants