perfshield 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/runner.js +14 -2
  2. package/package.json +1 -1
package/lib/runner.js CHANGED
@@ -8,6 +8,12 @@ import { computeDifference, summaryStats } from "./stats.js";
8
8
  const versions = ["baseline", "current"];
9
9
  const autoSampleBatchSize = 10;
10
10
  const harnessTempPrefix = "perfshield-harness-";
11
+ const getVersionOrder = seed => {
12
+ if (seed % 2 === 0) {
13
+ return versions;
14
+ }
15
+ return [versions[1], versions[0]];
16
+ };
11
17
  const getHarnessPath = () => {
12
18
  const override = process.env.WEB_BENCHMARKER_HARNESS_PATH;
13
19
  if (override != null) {
@@ -70,10 +76,13 @@ const collectSamples = async (harness, benchmarks, minSamples) => {
70
76
  baseline: [],
71
77
  current: []
72
78
  }));
79
+ let roundRobinSeed = 0;
73
80
  for (let iteration = 0; iteration < minSamples; iteration += 1) {
74
81
  for (let index = 0; index < benchmarks.length; index += 1) {
75
82
  const descriptor = benchmarks[index];
76
- for (const version of versions) {
83
+ const order = getVersionOrder(roundRobinSeed);
84
+ roundRobinSeed += 1;
85
+ for (const version of order) {
77
86
  const result = await harness.runSample({
78
87
  index,
79
88
  iterations: descriptor.iterations,
@@ -108,6 +117,7 @@ const autoSampleResolved = (samples, conditions) => samples.every(bucket => {
108
117
  });
109
118
  const autoSample = async (harness, benchmarks, samples, conditions, timeoutMs) => {
110
119
  const startTime = Date.now();
120
+ let roundRobinSeed = 0;
111
121
  while (Date.now() - startTime < timeoutMs) {
112
122
  if (autoSampleResolved(samples, conditions)) {
113
123
  return;
@@ -115,7 +125,9 @@ const autoSample = async (harness, benchmarks, samples, conditions, timeoutMs) =
115
125
  for (let batch = 0; batch < autoSampleBatchSize; batch += 1) {
116
126
  for (let index = 0; index < benchmarks.length; index += 1) {
117
127
  const descriptor = benchmarks[index];
118
- for (const version of versions) {
128
+ const order = getVersionOrder(roundRobinSeed);
129
+ roundRobinSeed += 1;
130
+ for (const version of order) {
119
131
  const result = await harness.runSample({
120
132
  index,
121
133
  iterations: descriptor.iterations,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perfshield",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A tool for doing web benchmarking across multiple JS engines and with statistical signifigance",
5
5
  "license": "MIT",
6
6
  "type": "module",