Repository navigation
bench: nothing timed selector matching against Lexbor - #73
Merged
Merged
Conversation
A table after the pages runs the 32 selectors from examples/select.rs over the 13 real pages, Parsec's select against Lexbor's lxb_selectors_find with LXB_SELECTORS_OPT_MATCH_FIRST, both on documents built beforehand. Each row is the median of 30 runs and shows both match counts when they differ. `selectors` on the command line runs only this table.
Brings in the cached sibling positions for :nth-child(an+b) and its kin, which had counted every earlier sibling for each element.
build.rs reran when .git/HEAD changed, but a commit moves the branch HEAD points to and leaves HEAD alone, so the stamp went stale.
Adds the selector results from bench/ and marks M1 done in the roadmap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
bench/timed parsing only. Nothing compared Parsec's selector matching with Lexbor's, so the README couldn't say how queries compare, and nobody would have seen that:nth-child(an+b)was quadratic in the number of siblings.Change
bench/src/selectors.rsruns the 32-selector battery fromexamples/select.rsover the 13 real pages: Parsec'sSelectorList::selectagainst Lexbor'slxb_selectors_find, with both documents built beforehand. Each time is the median of 30 runs after a warm-up. Lexbor is set up as itsexamples/lexbor/selectors/normal_way.cdoes, withLXB_SELECTORS_OPT_MATCH_FIRSTso a node is reported once, asquerySelectorAlldoes.bench … selectorsruns only that table; a plain run prints it after the parse tables.p:nth-child(2n+1)took Parsec 314 ms over the pages, nearly as slow as Lexbor.build.rswatched.git/HEAD, which a commit doesn't touch.Results (Apple M2 Max, three runs, within 2% of each other)
body *:last-child) to 3.9× (tr:nth-of-type(odd)), and 30.8× onp:nth-child(2n+1), which takes Lexbor 339 ms.[href], 82,212 against Lexbor's 82,220. Lexbor also matches SVG'sxlink:href; a selector with no namespace prefix matches attributes with no namespace, so Parsec's count is the right one.Tests
cargo fmt,cargo clippy --release -- -D warningsandcargo deny check licenses bans sourcesonbench/are clean.cargo test --test csspasses, including the newstepped_child_index_counts_mixed_siblingsfrom Netweir.scripts/check-headers.shpasses.Fixes #3