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 complexity param #430

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

camillobruni
Copy link
Contributor

@camillobruni camillobruni commented Oct 9, 2024

Work in progress proposal for adding a variable complexity param.

  • complexity === 1.0: workloads run in default configuration
  • complexity > 1.0: ideally workloads run proportionally slower
  • complexity < 1.0: ideally workloads run proportionally fast

Background:
We're occasionally seeing issues with gc timing / optimisations heuristics with the current workloads. If we can dynamically change the duration / complexity of workloads it's a bit easier to assess how good these heuristics are and how much we're potentially overfitting.

Current Limitations:

  • DeveloperMode UI cannot reload tests.mjs causing stale BenchmarkTestStep titles
  • Only TodoMVC are currently scaling the workload size (other workloads are depend on whether we're fine with the general idea here)

@@ -66,7 +71,8 @@ Suites.push({
page.getLocalStorage().getItem("javascript-es5");
},
tests: [
new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => {
new BenchmarkTestStep(`Adding${getNumberOfItemsToAdd()}Items`, (page) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I should just stick to using defaultNumberOfItemsToAdd here, so that the metric names don't change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the name should reflect the complexity level, in an effort to avoid comparing a simple test run with a complex test run

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could remove the number here and handle this during reporting time - update the code that consumes the name after the run when reporting in the UI or JSON as either TodoMVC-LocalStorage (Complexity 1.5) -> AddingItems, or TodoMVC-LocalStorage -> AddingItems (Complexity 1.5) when complexity !== 1? One tradeoff there is it would report with complexity even in tests that aren't complexity-aware, but that seems maybe fine given that this is an opt-in thing that you'd only use if you know what you're doing.

@rniwa WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely open to either suggestion. getNumberOfItemsToAdd() would work partially if the complexity param is passed-in via url-params only (but that's a bit brittle).

Copy link
Contributor

Choose a reason for hiding this comment

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

Naively I'd do this:

  • add the complexity value somewhere in the json report, but not in all tests. Also display it somewhere in the results interface.
  • remove any mention of actual counts in the test titles

But I'm not convinced this is right, because we might want the tests themselves to hold this value so that it's clear in reports that we're not at the default complexity.

Also if we want to change the actual titles, I'd like to see the complexity in the test names more than in the steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • I can add a non-standard-params warning in the detailed results page to surface what's happening
  • I'd vouch for dropping mentioning the complexity params (much like other score-influencing params, we don't surface them anywhere else)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the latest commit I've just removed the reference to 100 in the step title.

@camillobruni camillobruni marked this pull request as draft October 9, 2024 14:08
@camillobruni camillobruni changed the title WIP: Add complexity param Add complexity param Oct 9, 2024
@bgrins
Copy link
Contributor

bgrins commented Oct 10, 2024

Without looking closely at the code change, I think this is a neat idea and I could imagine us increasing the complexity of charts, text editing, etc if we move forward with it. Will be curious for feedback from @julienw.

Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

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

I like the idea :-)

@@ -101,11 +102,21 @@ function createUIForSyncStepDelay() {
return label;
}

function createTimeRangeUI(labelText, initialValue, unit = "ms", min = 0, max = 1000) {
function createUIForComplexity() {
const { range, label } = createTimeRangeUI("Relative complexity", params.complexity, "x", 0, 10, 0.01);
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking that rather than a float, maybe this can be an integer between 1 and 100, with 50 being the default?

Then later you can divide this number by 50 to get the multiplier.
And you can cut down a lot of the changes.

But this is merely a suggestion, I'm also happy with what you did.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kinda prefer a normalized float value, aiming quite literaly at a complexity-factor, 2x => it should run roughly twice as slow.

@@ -66,7 +71,8 @@ Suites.push({
page.getLocalStorage().getItem("javascript-es5");
},
tests: [
new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => {
new BenchmarkTestStep(`Adding${getNumberOfItemsToAdd()}Items`, (page) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Naively I'd do this:

  • add the complexity value somewhere in the json report, but not in all tests. Also display it somewhere in the results interface.
  • remove any mention of actual counts in the test titles

But I'm not convinced this is right, because we might want the tests themselves to hold this value so that it's clear in reports that we're not at the default complexity.

Also if we want to change the actual titles, I'd like to see the complexity in the test names more than in the steps.

@camillobruni
Copy link
Contributor Author

camillobruni commented Oct 11, 2024

  • Only create new Params object if there are URL search params
  • Added table to highlight non-standard params if there are is a default to the defaultParams object
Screenshot 2024-10-11 at 14 15 17

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.

4 participants