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

Add new benchmark for css selectors #3647

Merged
merged 19 commits into from
Dec 28, 2023
Merged

Add new benchmark for css selectors #3647

merged 19 commits into from
Dec 28, 2023

Conversation

asamuzaK
Copy link
Contributor

@asamuzaK asamuzaK commented Dec 27, 2023

Split from #3644

The reasons for using try-catch are:

  • The selector list contains invalid selectors.
  • Even if the selector is valid, an exception will be thrown if nwsapi fails to parse.

Benchmark result on my local PC is:

# selectors/selector/querySelectorAll #
18/273 fails.
jsdom  x 1.14 ops/sec ±5.54% (7 runs sampled)

Create `selectors` directory and add `sizzle` submodule
The reasons for using try-catch are:
* The list contains invalid selectors.
* Even if the selector is valid, an exception will be thrown if nwsapi does not support it.
log:
# selectors/selector/querySelectorAll #
jsdom  x 1.11 ops/sec ±4.85% (7 runs sampled)
@asamuzaK
Copy link
Contributor Author

The more errors there are, the shorter the processing time is, so I think it to be slower if it is tested on dom-selector.

log:
# selectors/selector/querySelectorAll #
18/273 fails.
jsdom  x 1.14 ops/sec ±5.54% (7 runs sampled)
.gitmodules Outdated Show resolved Hide resolved
benchmark/selectors/selector.js Outdated Show resolved Hide resolved
@asamuzaK
Copy link
Contributor Author

Log:

# selectors/selector/querySelectorAll #
18/273 fails.
jsdom  x 1.15 ops/sec ±6.53% (7 runs sampled)

# selectors/selector/querySelectorAll only nwsapi supported #
jsdom  x 1.18 ops/sec ±11.85% (7 runs sampled)

@domenic
Copy link
Member

domenic commented Dec 28, 2023

Log:

Great! And what are the results for dom-selector?

@asamuzaK
Copy link
Contributor Author

I haven't tested it yet.
Once this PR is merged, I plan to rebase #3644 and test it there.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with nits; please fix those and then we'll merge. (I apologize, I might merge tomorrow, as I need to head to bed soon...)

benchmark/selectors/sizzle-speed/images/favicon.ico Outdated Show resolved Hide resolved
benchmark/selectors/sizzle-speed/data/selector.html Outdated Show resolved Hide resolved
benchmark/selectors/selector.js Outdated Show resolved Hide resolved
@asamuzaK
Copy link
Contributor Author

Latest log:

# selectors/selector/querySelectorAll #
18/273 fails.
jsdom  x 1.20 ops/sec ±10.21% (7 runs sampled)

# selectors/selector/querySelectorAll only nwsapi supports #
jsdom  x 1.24 ops/sec ±8.02% (7 runs sampled)

@domenic domenic merged commit 7695f28 into jsdom:main Dec 28, 2023
5 checks passed
@asamuzaK asamuzaK deleted the sizzle branch December 28, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants