perfshield 0.0.2 → 0.0.3

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.
package/README.md CHANGED
@@ -62,10 +62,7 @@ export const benchmarks = [
62
62
  "sampling": {
63
63
  "minSamples": 30,
64
64
  "timeoutMs": 10000,
65
- "conditions": {
66
- "absolute": [0],
67
- "relative": [0]
68
- }
65
+ "conditions": [0]
69
66
  },
70
67
  "report": {
71
68
  "formats": ["console", "json"]
@@ -13,10 +13,7 @@
13
13
  "sampling": {
14
14
  "minSamples": 30,
15
15
  "timeoutMs": 10000,
16
- "conditions": {
17
- "absolute": [0],
18
- "relative": [0]
19
- }
16
+ "conditions": [0]
20
17
  },
21
18
  "report": {
22
19
  "formats": ["console", "json"]
package/lib/config.js CHANGED
@@ -158,26 +158,6 @@ const parseEngineConfig = (value, index, issues) => {
158
158
  name
159
159
  };
160
160
  };
161
- const parseSamplingConditions = (value, issues) => {
162
- const conditions = asObject(value, "config.sampling.conditions", issues);
163
- if (!conditions) {
164
- return null;
165
- }
166
- validateKeys(conditions, ["absolute", "relative"], "config.sampling.conditions", issues);
167
- const absolute = asNumberArray(conditions.absolute, "config.sampling.conditions.absolute", issues, {
168
- minLength: 1
169
- });
170
- const relative = asNumberArray(conditions.relative, "config.sampling.conditions.relative", issues, {
171
- minLength: 1
172
- });
173
- if (!absolute || !relative) {
174
- return null;
175
- }
176
- return {
177
- absolute,
178
- relative
179
- };
180
- };
181
161
  const parseSamplingConfig = (value, issues) => {
182
162
  const sampling = asObject(value, "config.sampling", issues);
183
163
  if (!sampling) {
@@ -192,7 +172,9 @@ const parseSamplingConfig = (value, issues) => {
192
172
  integer: true,
193
173
  min: 1
194
174
  });
195
- const conditions = parseSamplingConditions(sampling.conditions, issues);
175
+ const conditions = asNumberArray(sampling.conditions, "config.sampling.conditions", issues, {
176
+ minLength: 1
177
+ });
196
178
  if (minSamples == null || timeoutMs == null || !conditions) {
197
179
  return null;
198
180
  }
package/lib/regression.js CHANGED
@@ -3,9 +3,8 @@ export const getRegressions = results => {
3
3
  const findings = [];
4
4
  for (const result of results) {
5
5
  for (const entry of result.benchmarks) {
6
- if (isPositiveInterval(entry.difference.absolute.ci) || isPositiveInterval(entry.difference.relative.ci)) {
6
+ if (isPositiveInterval(entry.difference.relative.ci)) {
7
7
  findings.push({
8
- absolute: entry.difference.absolute.ci,
9
8
  benchmark: entry.benchmark.name,
10
9
  engine: result.engine.name,
11
10
  relative: entry.difference.relative.ci
@@ -16,7 +16,7 @@ export const renderConsoleReport = results => {
16
16
  lines.push(`Engine: ${result.engine.name}`);
17
17
  for (const entry of result.benchmarks) {
18
18
  const unit = entry.benchmark.unit != null ? ` ${entry.benchmark.unit}` : "";
19
- const benchmarkLines = [` Benchmark: ${entry.benchmark.name}`, ` baseline mean=${formatNumber(entry.stats.baseline.mean, 4)}${unit} ci=${formatInterval(entry.stats.baseline.meanCI, 4)} sd=${formatNumber(entry.stats.baseline.standardDeviation, 4)}`, ` current mean=${formatNumber(entry.stats.current.mean, 4)}${unit} ci=${formatInterval(entry.stats.current.meanCI, 4)} sd=${formatNumber(entry.stats.current.standardDeviation, 4)}`, ` diff abs mean=${formatNumber(entry.difference.absolute.mean, 4)}${unit} ci=${formatInterval(entry.difference.absolute.ci, 4)}`, ` diff rel mean=${formatRelativeValue(entry.difference.relative.mean, 2)} ci=${formatRelativeInterval(entry.difference.relative.ci, 2)}`];
19
+ const benchmarkLines = [` Benchmark: ${entry.benchmark.name}`, ` baseline mean=${formatNumber(entry.stats.baseline.mean, 4)}${unit} ci=${formatInterval(entry.stats.baseline.meanCI, 4)} sd=${formatNumber(entry.stats.baseline.standardDeviation, 4)}`, ` current mean=${formatNumber(entry.stats.current.mean, 4)}${unit} ci=${formatInterval(entry.stats.current.meanCI, 4)} sd=${formatNumber(entry.stats.current.standardDeviation, 4)}`, ` diff rel mean=${formatRelativeValue(entry.difference.relative.mean, 2)} ci=${formatRelativeInterval(entry.difference.relative.ci, 2)}`];
20
20
  lines.push(...benchmarkLines);
21
21
  }
22
22
  lines.push("");
package/lib/runner.js CHANGED
@@ -103,12 +103,7 @@ const autoSampleResolved = (samples, conditions) => samples.every(bucket => {
103
103
  const baselineStats = summaryStats(bucket.baseline);
104
104
  const currentStats = summaryStats(bucket.current);
105
105
  const diff = computeDifference(baselineStats, currentStats);
106
- for (const condition of conditions.absolute) {
107
- if (intervalContains(diff.absolute.ci, condition)) {
108
- return false;
109
- }
110
- }
111
- for (const condition of conditions.relative) {
106
+ for (const condition of conditions) {
112
107
  if (intervalContains(diff.relative.ci, condition)) {
113
108
  return false;
114
109
  }
package/lib/stats.js CHANGED
@@ -23,10 +23,6 @@ export const samplingDistributionOfTheMean = (distribution, sampleSize) => ({
23
23
  mean: distribution.mean,
24
24
  variance: distribution.variance / sampleSize
25
25
  });
26
- export const samplingDistributionOfAbsoluteDifferenceOfMeans = (a, b) => ({
27
- mean: b.mean - a.mean,
28
- variance: a.variance + b.variance
29
- });
30
26
  export const samplingDistributionOfRelativeDifferenceOfMeans = (a, b) => ({
31
27
  mean: (b.mean - a.mean) / a.mean,
32
28
  variance: (a.variance * b.mean * b.mean + b.variance * a.mean * a.mean) / (a.mean * a.mean * a.mean * a.mean)
@@ -65,14 +61,9 @@ export const computeDifference = (baseline, current) => {
65
61
  mean: current.mean,
66
62
  variance: current.variance
67
63
  }, current.size);
68
- const absoluteDist = samplingDistributionOfAbsoluteDifferenceOfMeans(baselineDist, currentDist);
69
64
  const relativeDist = samplingDistributionOfRelativeDifferenceOfMeans(baselineDist, currentDist);
70
65
  const size = Math.min(baseline.size, current.size);
71
66
  return {
72
- absolute: {
73
- ci: confidenceInterval95(absoluteDist, size),
74
- mean: absoluteDist.mean
75
- },
76
67
  relative: {
77
68
  ci: confidenceInterval95(relativeDist, size),
78
69
  mean: relativeDist.mean
@@ -92,12 +83,7 @@ export const autoSampleConditionsResolved = (resultStats, conditions) => {
92
83
  if (diff == null) {
93
84
  continue;
94
85
  }
95
- for (const condition of conditions.absolute) {
96
- if (intervalContains(diff.absolute.ci, condition)) {
97
- return false;
98
- }
99
- }
100
- for (const condition of conditions.relative) {
86
+ for (const condition of conditions) {
101
87
  if (intervalContains(diff.relative.ci, condition)) {
102
88
  return false;
103
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perfshield",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
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",