-
Notifications
You must be signed in to change notification settings - Fork 144
[TASK] Always calculate selector specificity on demand #1028
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
Conversation
2d60478
to
412a2df
Compare
26eab63
to
48d8842
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the optimization, as it would give a significant performance improvement, when, for example, sorting selectors by specificity, which would be quite a common use case. As long as the cached value if cleared when setSelector
is called (which it is), I don't see it causing a problem.
We should, however, still remove the setting of the cached value in the constructor, as this is unnecessary (and a performance hit).
48d8842
to
b7d1926
Compare
This avoids additional state that makes it hard to compare selectors for equality. Also, this will improve performance for cases where the specificity is not needed (but will slightly worsen performance where the specificity is queried multiple times on the same selector instance). Closes #1021
b7d1926
to
8570e6b
Compare
I have now changed `Selector' to use the new utility class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat.
I removed the bit in the commit message about performance downgrade, since this is no longer the case. |
Thanks! |
This avoids additional state that makes it hard to compare
selectors for equality.
Also, this will improve performance for cases where the
specificity is not needed (but will slightly worsen
performance where the specificity is queried multiple times
on the same selector instance).
Closes #1021