Skip to content

Don't measure cost of data allocation in benchmarks #3607

Open
@nolanlawson

Description

@nolanlawson

A lot of our benchmark code looks like this:

before(() => {
  // ...
});

run(() => {
  const store = new Store();
  store.runLots();
  // do something
})

Since the store.runLots() (or store.run()) is in the run() hook, we are measuring the cost of allocating a large array of data (in this case, a 10k array). This pointlessly increases the measured time with something that we effectively don't control.

We should move the store-building logic into the before() hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUG P3Up for grabsIssues that are relatively small, self-contained, and ready for implementationtests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions