Skip to content

Commit 7ed0120

Browse files
committed
rename to removeOutliers
1 parent fafdd15 commit 7ed0120

10 files changed

+34
-34
lines changed

.changeset/purple-jokes-rhyme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@callstack/reassure-measure': minor
33
---
44

5-
Added a `dropOutliers` option to detect and drop statistical outliers
5+
Added a `removeOutliers` option to detect and drop statistical outliers

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ async function measureRenders(
370370
interface MeasureRendersOptions {
371371
runs?: number;
372372
warmupRuns?: number;
373-
dropOutliers?: boolean;
373+
removeOutliers?: boolean;
374374
wrapper?: React.ComponentType<{ children: ReactElement }>;
375375
scenario?: (view?: RenderResult) => Promise<any>;
376376
writeFile?: boolean;
@@ -379,7 +379,7 @@ interface MeasureRendersOptions {
379379

380380
- **`runs`**: number of runs per series for the particular test
381381
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs (default 1).
382-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
382+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
383383
- **`wrapper`**: React component, such as a `Provider`, which the `ui` will be wrapped with. Note: the render duration of the `wrapper` itself is excluded from the results; only the wrapped component is measured.
384384
- **`scenario`**: a custom async function, which defines user interaction within the UI by utilising RNTL or RTL functions
385385
- **`writeFile`**: should write output to file (default `true`)
@@ -401,14 +401,14 @@ async function measureFunction(
401401
interface MeasureFunctionOptions {
402402
runs?: number;
403403
warmupRuns?: number;
404-
dropOutliers?: boolean;
404+
removeOutliers?: boolean;
405405
writeFile?: boolean;
406406
}
407407
```
408408

409409
- **`runs`**: number of runs per series for the particular test
410410
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
411-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
411+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
412412
- **`writeFile`**: should write output to file (default `true`)
413413

414414
#### `measureAsyncFunction` function
@@ -430,14 +430,14 @@ async function measureAsyncFunction(
430430
interface MeasureAsyncFunctionOptions {
431431
runs?: number;
432432
warmupRuns?: number;
433-
dropOutliers?: boolean;
433+
removeOutliers?: boolean;
434434
writeFile?: boolean;
435435
}
436436
```
437437

438438
- **`runs`**: number of runs per series for the particular test
439439
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
440-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
440+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
441441
- **`writeFile`**: should write output to file (default `true`)
442442

443443
### Configuration

docusaurus/docs/api.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test('Test with scenario', async () => {
5050
interface MeasureRendersOptions {
5151
runs?: number;
5252
warmupRuns?: number;
53-
dropOutliers?: boolean;
53+
removeOutliers?: boolean;
5454
wrapper?: React.ComponentType<{ children: ReactElement }>;
5555
scenario?: (view?: RenderResult) => Promise<any>;
5656
writeFile?: boolean;
@@ -59,7 +59,7 @@ interface MeasureRendersOptions {
5959
6060
- **`runs`**: number of runs per series for the particular test
6161
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs (default: 1)
62-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
62+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
6363
- **`wrapper`**: React component, such as a `Provider`, which the `ui` will be wrapped with. Note: the render duration of the `wrapper` itself is excluded from the results, only the wrapped component is measured.
6464
- **`scenario`**: a custom async function, which defines user interaction within the ui by utilized RNTL functions
6565
- **`writeFile`**: should write output to file (default `true`)
@@ -93,14 +93,14 @@ test('fib 30', async () => {
9393
interface MeasureFunctionOptions {
9494
runs?: number;
9595
warmupRuns?: number;
96-
dropOutliers?: boolean;
96+
removeOutliers?: boolean;
9797
writeFile?: boolean;
9898
}
9999
```
100100
101101
- **`runs`**: number of runs per series for the particular test
102102
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
103-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
103+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
104104
- **`writeFile`**: should write output to file (default `true`)
105105
106106
### `measureAsyncFunction` function {#measure-async-function}
@@ -140,14 +140,14 @@ test('fib 30', async () => {
140140
interface MeasureAsyncFunctionOptions {
141141
runs?: number;
142142
warmupRuns?: number;
143-
dropOutliers?: boolean;
143+
removeOutliers?: boolean;
144144
writeFile?: boolean;
145145
}
146146
```
147147
148148
- **`runs`**: number of runs per series for the particular test
149149
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
150-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
150+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
151151
- **`writeFile`**: (default `true`) should write output to file
152152
153153
## Configuration

packages/measure/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Minor Changes
66

77
- c51fb5f: feat: add measureAsyncFunction
8-
- 59b21d4: Added a `dropOutliers` option to detect and drop statistical outliers
8+
- 59b21d4: Added a `removeOutliers` option to detect and drop statistical outliers
99

1010
### Patch Changes
1111

packages/measure/src/config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ export type Cleanup = () => void;
66
type Config = {
77
runs: number;
88
warmupRuns: number;
9-
dropOutliers: boolean;
9+
removeOutliers: boolean;
1010
outputFile: string;
1111
testingLibrary?: TestingLibrary;
1212
};
1313

1414
const defaultConfig: Config = {
1515
runs: 10,
1616
warmupRuns: 1,
17-
dropOutliers: true,
17+
removeOutliers: true,
1818
outputFile: process.env.REASSURE_OUTPUT_FILE ?? '.reassure/current.perf',
1919
testingLibrary: undefined,
2020
};

packages/measure/src/measure-async-function.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function measureAsyncFunctionInternal(
2525
): Promise<MeasureResults> {
2626
const runs = options?.runs ?? config.runs;
2727
const warmupRuns = options?.warmupRuns ?? config.warmupRuns;
28-
const dropOutliers = options?.dropOutliers ?? config.dropOutliers;
28+
const removeOutliers = options?.removeOutliers ?? config.removeOutliers;
2929

3030
showFlagsOutputIfNeeded();
3131

@@ -39,5 +39,5 @@ async function measureAsyncFunctionInternal(
3939
runResults.push({ duration, count: 1 });
4040
}
4141

42-
return processRunResults(runResults, { warmupRuns, dropOutliers });
42+
return processRunResults(runResults, { warmupRuns, removeOutliers });
4343
}

packages/measure/src/measure-function.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { showFlagsOutputIfNeeded, writeTestStats } from './output';
66
export interface MeasureFunctionOptions {
77
runs?: number;
88
warmupRuns?: number;
9-
dropOutliers?: boolean;
9+
removeOutliers?: boolean;
1010
writeFile?: boolean;
1111
}
1212

@@ -23,7 +23,7 @@ export async function measureFunction(fn: () => void, options?: MeasureFunctionO
2323
function measureFunctionInternal(fn: () => void, options?: MeasureFunctionOptions): MeasureResults {
2424
const runs = options?.runs ?? config.runs;
2525
const warmupRuns = options?.warmupRuns ?? config.warmupRuns;
26-
const dropOutliers = options?.dropOutliers ?? config.dropOutliers;
26+
const removeOutliers = options?.removeOutliers ?? config.removeOutliers;
2727

2828
showFlagsOutputIfNeeded();
2929

@@ -37,5 +37,5 @@ function measureFunctionInternal(fn: () => void, options?: MeasureFunctionOption
3737
runResults.push({ duration, count: 1 });
3838
}
3939

40-
return processRunResults(runResults, { warmupRuns, dropOutliers });
40+
return processRunResults(runResults, { warmupRuns, removeOutliers });
4141
}

packages/measure/src/measure-helpers.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ export interface RunResult {
1010

1111
type ProcessRunResultsOptions = {
1212
warmupRuns: number;
13-
dropOutliers?: boolean;
13+
removeOutliers?: boolean;
1414
};
1515

1616
export function processRunResults(inputResults: RunResult[], options: ProcessRunResultsOptions): MeasureResults {
1717
const warmupResults = inputResults.slice(0, options.warmupRuns);
1818
const runResults = inputResults.slice(options.warmupRuns);
1919

20-
const { results, outliers } = options.dropOutliers ? findOutliers(runResults) : { results: runResults };
20+
const { results, outliers } = options.removeOutliers ? findOutliers(runResults) : { results: runResults };
2121

2222
const durations = results.map((result) => result.duration);
23-
const meanDuration = math.mean(durations) as number;
23+
const meanDuration = math.mean(...durations) as number;
2424
const stdevDuration = math.std(...durations);
2525
const warmupDurations = warmupResults.map((result) => result.duration);
2626
const outlierDurations = outliers?.map((result) => result.duration);
2727

2828
const counts = runResults.map((result) => result.count);
29-
const meanCount = math.mean(counts) as number;
29+
const meanCount = math.mean(...counts) as number;
3030
const stdevCount = math.std(...counts);
3131

3232
return {

packages/measure/src/measure-renders.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ logger.configure({
1616
export interface MeasureRendersOptions {
1717
runs?: number;
1818
warmupRuns?: number;
19-
dropOutliers?: boolean;
19+
removeOutliers?: boolean;
2020
wrapper?: React.ComponentType<{ children: React.ReactElement }>;
2121
scenario?: (screen: any) => Promise<any>;
2222
writeFile?: boolean;
@@ -56,7 +56,7 @@ async function measureRendersInternal(
5656
const runs = options?.runs ?? config.runs;
5757
const scenario = options?.scenario;
5858
const warmupRuns = options?.warmupRuns ?? config.warmupRuns;
59-
const dropOutliers = options?.dropOutliers ?? config.dropOutliers;
59+
const removeOutliers = options?.removeOutliers ?? config.removeOutliers;
6060

6161
const { render, cleanup } = resolveTestingLibrary();
6262
const testingLibrary = getTestingLibrary();
@@ -114,7 +114,7 @@ async function measureRendersInternal(
114114
revertRenderPolyfills();
115115

116116
return {
117-
...processRunResults(runResults, { warmupRuns, dropOutliers }),
117+
...processRunResults(runResults, { warmupRuns, removeOutliers }),
118118
issues: {
119119
initialUpdateCount: initialRenderCount - 1,
120120
redundantUpdates: detectRedundantUpdates(renderJsonTrees, initialRenderCount),

packages/reassure/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ async function measureRenders(
370370
interface MeasureRendersOptions {
371371
runs?: number;
372372
warmupRuns?: number;
373-
dropOutliers?: boolean;
373+
removeOutliers?: boolean;
374374
wrapper?: React.ComponentType<{ children: ReactElement }>;
375375
scenario?: (view?: RenderResult) => Promise<any>;
376376
writeFile?: boolean;
@@ -379,7 +379,7 @@ interface MeasureRendersOptions {
379379

380380
- **`runs`**: number of runs per series for the particular test
381381
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs (default 1).
382-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
382+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
383383
- **`wrapper`**: React component, such as a `Provider`, which the `ui` will be wrapped with. Note: the render duration of the `wrapper` itself is excluded from the results; only the wrapped component is measured.
384384
- **`scenario`**: a custom async function, which defines user interaction within the UI by utilising RNTL or RTL functions
385385
- **`writeFile`**: should write output to file (default `true`)
@@ -401,14 +401,14 @@ async function measureFunction(
401401
interface MeasureFunctionOptions {
402402
runs?: number;
403403
warmupRuns?: number;
404-
dropOutliers?: boolean;
404+
removeOutliers?: boolean;
405405
writeFile?: boolean;
406406
}
407407
```
408408

409409
- **`runs`**: number of runs per series for the particular test
410410
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
411-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
411+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
412412
- **`writeFile`**: should write output to file (default `true`)
413413

414414
#### `measureAsyncFunction` function
@@ -430,14 +430,14 @@ async function measureAsyncFunction(
430430
interface MeasureAsyncFunctionOptions {
431431
runs?: number;
432432
warmupRuns?: number;
433-
dropOutliers?: boolean;
433+
removeOutliers?: boolean;
434434
writeFile?: boolean;
435435
}
436436
```
437437

438438
- **`runs`**: number of runs per series for the particular test
439439
- **`warmupRuns`**: number of additional warmup runs that will be done and discarded before the actual runs
440-
- **`dropOutliers`**: should remove statistical outlier results (default: `true`)
440+
- **`removeOutliers`**: should remove statistical outlier results (default: `true`)
441441
- **`writeFile`**: should write output to file (default `true`)
442442

443443
### Configuration

0 commit comments

Comments
 (0)