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

perf: add js-framework-benchmark tests #4069

Merged
merged 1 commit into from Mar 18, 2024

Conversation

nolanlawson
Copy link
Contributor

@nolanlawson nolanlawson commented Mar 15, 2024

Details

As we track our progress with fine-grained reactivity (#3624), I think it would be helpful to have the actual js-framework-benchmark benchmarks in our local benchmarks. Otherwise, it's kind of a pain to set up js-framework-benchmark itself, link it to LWC, and run it to see the results.

This PR is my attempt to replicate as closely as possible what js-framework-benchmark is doing. A few limitations:

  • There is some overlap here with existing benchmarks, which were clearly also inspired by js-framework-benchmark but are slightly different.
  • Some of the benchmarks execute quite quickly (<5ms), which is not great for Tachometer since it tends to lead to lots of variance. (Update: opened perf: add throttling to tachometer benchmarks #4070 to resolve this.)

Despite these limitations, I still think this is worth doing, at least to see our historical trend over time as we try to improve these benchmark results.

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • 🤞 No, it does not introduce an observable change.

@nolanlawson nolanlawson requested a review from a team as a code owner March 15, 2024 20:58
await add();
},
}
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

return [
action,
async () => {
elm.querySelector(id).click();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could extract out these querySelectors so that we don't pay the cost in the actual benchmark run, but 1) it doesn't seem to affect the numbers much, and 2) js-framework-benchmark seems to be implicitly doing this as well (assuming that WebDriver/Puppeteer delegate out to document.querySelector).

Copy link
Member

@jmsjtu jmsjtu left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding these!

@nolanlawson nolanlawson merged commit 074c1e0 into master Mar 18, 2024
9 checks passed
@nolanlawson nolanlawson deleted the nolan/js-framework-benchmark branch March 18, 2024 15:50
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

3 participants