-
Notifications
You must be signed in to change notification settings - Fork 19
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
Update selectors
crate to 0.25, and enables :has
and :is
selectors.
#65
base: main
Are you sure you want to change the base?
Conversation
Thanks! I don't see any benchmarks. Do you have numbers for how much the selector cache helps? |
I don't and it might take some thought as to how to construct one. From what I understand, it only matters for selectors that contain |
Running on an AMD Framework 13 with a Ryzen 7 7840U:
Strangely, I'm observing that the cache increases performance for even selectors that shouldn't need to use the cache. I tested with LTO turned on, and that didn't help, so it's not some inlining-related issue. I'm not sure why. |
Thanks for adding benchmarks! Seems like a modest speed up for the expected cases? I'm just trying to balance this against the scary warning about crossing the streams with |
Cargo.toml
Outdated
[dependencies] | ||
cssparser = "0.31" | ||
html5ever = "0.27.0" | ||
selectors = "0.25" | ||
indexmap = "2.2.6" | ||
|
||
[dev-dependencies] | ||
tempfile = "3" | ||
criterion = { version = "0.4", features = ["html_reports"] } |
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.
version 0.5 please, to avoid cargo audit
warnings.
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.
Gah. My IDE betrayed me.
Now that I think about it and reading through the code, I don't think it's accurate. The only time it'll cause errors if you mutate a node such that it is still the same I'll edit the documentation to be more specific. |
After looking at the generated assembly, I think I do have a satisfying explanation for why the cache helps even when |
There is also an active fork of I'm investigating it right now too. This would go all the way to cssparser 0.33 Edit: It'd be a LOT more work, because |
Any update on this PR? The current version should have all the reviews addressed. |
Thanks for you patience. I'm away this week, but will follow up when I get back. |
@Lymia Unfortunately I'm not longer with Brave, so I won't be able to merge this. Hopefully someone else will take over maintenance. |
This is a (very minor) breaking change to the API because it adds a new field to the
Select
iterator in order to add caching for:nth-child
.If this is not wanted, don't pull the last commit
da1d495407d5e8b5801172e1061db528fe9e0ffa
.