Skip to content

Don't clone input buffer inside html5ever benchmark loop #634

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

simonwuelker
Copy link
Contributor

@simonwuelker simonwuelker commented Jun 26, 2025

This clone operation should not be counted towards the benchmark time. When the benchmark was written criterion did not support per-iteration setup, but now it does using Bencher::iter_batched. Using this method reduces the benchmark time by 9% in lipsum.html.

Additionally, the way html5ever was used inside the benchmarks was wrong if there were <script> elements in the input.
To fully tokenize input in html5ever, you need to spin on the Tokenizer::feed method until it returns Done.
None of our benchmarks contain any script elements, but it's better to fix it anyways.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
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.

1 participant