Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
1d27c52
feat(examples-plugins): add example benchmark plugin
BioPhoton Feb 26, 2024
9446414
wip
BioPhoton Feb 26, 2024
68bfaa8
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Feb 26, 2024
7e83905
wip
BioPhoton Feb 27, 2024
383df4e
wip
BioPhoton Feb 27, 2024
76893f2
wip
BioPhoton Feb 27, 2024
c50ef95
refactor: format
BioPhoton Feb 27, 2024
17f58e6
refactor: format
BioPhoton Feb 27, 2024
9c31528
refactor: set weight
BioPhoton Feb 27, 2024
7dfd97d
refactor: set better weight
BioPhoton Feb 27, 2024
95cbc0b
refactor: adjust logic
BioPhoton Feb 27, 2024
1a6946d
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Feb 28, 2024
952fdc2
refactor(examples-plugins): adjust benchmark js logic
BioPhoton Feb 28, 2024
a09095a
test(utils): fix flaky toGitPath tests
matejchalk Feb 29, 2024
27f66b3
Merge branch 'main' into git-tests-fix
BioPhoton Mar 1, 2024
54fabe4
wip
BioPhoton Mar 1, 2024
1de146c
test(utils): added test folder per describe
BioPhoton Mar 2, 2024
cde964d
test(utils): move git tests folder out of tmp
BioPhoton Mar 2, 2024
974a724
test(utils): add config
BioPhoton Mar 2, 2024
052b34c
Merge branch 'git-tests-fix' into examples-plugins-benchmark-js
BioPhoton Mar 2, 2024
e9cdcfb
wip
BioPhoton Mar 3, 2024
79fe217
wip
BioPhoton Mar 3, 2024
82bf552
wip
BioPhoton Mar 3, 2024
51223a1
test(examples-plugins): fix tests
BioPhoton Mar 3, 2024
1bbaa01
test(examples-plugins): fix tests
BioPhoton Mar 4, 2024
d441a54
refactor(examples-plugins): cleanup benchmark logic
BioPhoton Mar 4, 2024
61bd8bc
refactor(examples-plugins): add test run suite , change config
BioPhoton Mar 4, 2024
0f1132a
refactor(examples-plugins): fix runSuite naming
BioPhoton Mar 4, 2024
0bf3abe
refactor(examples-plugins): fix build
BioPhoton Mar 4, 2024
110b2b6
Update packages/utils/src/lib/git.integration.test.ts
BioPhoton Mar 4, 2024
d1e5e88
Update packages/utils/src/lib/git.integration.test.ts
BioPhoton Mar 4, 2024
aafad08
refactor(examples-plugins): format
BioPhoton Mar 4, 2024
5ebecdb
refactor(examples-plugins): adjust test
BioPhoton Mar 4, 2024
cdfb4b1
Update .github/workflows/ci.yml
BioPhoton Mar 4, 2024
f3de8a3
refactor(examples-plugins): adjust test
BioPhoton Mar 4, 2024
1c85949
Update packages/utils/src/lib/execute-process.ts
BioPhoton Mar 4, 2024
8e7f16c
Update packages/utils/src/lib/git.integration.test.ts
BioPhoton Mar 4, 2024
7cdd67c
Update packages/utils/src/lib/git.integration.test.ts
BioPhoton Mar 4, 2024
e817c37
refactor(examples-plugins): adjust test
BioPhoton Mar 4, 2024
2cdc750
merge main
BioPhoton Mar 4, 2024
1f78cc5
test(core): added test
BioPhoton Mar 4, 2024
baee067
test(core): fix lint
BioPhoton Mar 4, 2024
21f3ef5
test(core): add issues
BioPhoton Mar 4, 2024
ba53a5b
Merge branch 'git-tests-fix' into examples-plugins-benchmark-js
BioPhoton Mar 4, 2024
61b79af
test(core): add issues tests
BioPhoton Mar 4, 2024
8b94617
test(core): improve issues tests
BioPhoton Mar 4, 2024
e5d234e
docs(core): add link
BioPhoton Mar 4, 2024
2c9fdba
docs(core): add img
BioPhoton Mar 4, 2024
96d92b3
docs(examples-plugins): add helper section
BioPhoton Mar 4, 2024
5641f81
docs(examples-plugins): add icon
BioPhoton Mar 4, 2024
e15c45b
refactor(examples-plugins): adjust issue message
BioPhoton Mar 4, 2024
2f2e326
refactor: revert config
BioPhoton Mar 4, 2024
57735cc
test(examples-plugins): fix test on windows
BioPhoton Mar 4, 2024
4d24046
refactor(examples-plugins): remove comments
BioPhoton Mar 4, 2024
589793c
refactor(examples-plugins): format
BioPhoton Mar 4, 2024
d8f52db
refactor(examples-plugins): revert changes
BioPhoton Mar 4, 2024
86b8055
refactor(examples-plugins): adopt message
BioPhoton Mar 4, 2024
02ebdef
refactor(examples-plugins): edit image
BioPhoton Mar 4, 2024
c891634
refactor(examples-plugins): edit message
BioPhoton Mar 4, 2024
3aed3c4
refactor: tools
BioPhoton Mar 5, 2024
81087d3
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Mar 5, 2024
6615180
fix: lint
BioPhoton Mar 5, 2024
6c3ba93
refactor(examples-plugins): docs
BioPhoton Mar 5, 2024
1216aac
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Mar 5, 2024
246107f
test(examples-plugins): change test folder
BioPhoton Mar 5, 2024
dc71f00
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Mar 7, 2024
caf1a2d
refactor(utils): fix lint
BioPhoton Mar 7, 2024
1db1da5
refactor(utils): fix lint
BioPhoton Mar 7, 2024
2d148a5
refactor(example-plugins): use tinybench to benchmark
BioPhoton Mar 11, 2024
42a5dfc
refactor(example-plugins): fix lint
BioPhoton Mar 11, 2024
1e50630
refactor(example-plugins): update docs
BioPhoton Mar 11, 2024
6c3a6b7
refactor(example-plugins): update docs
BioPhoton Mar 11, 2024
c258cb7
refactor(example-plugins): update docs
BioPhoton Mar 11, 2024
edbff15
refactor(example-plugins): update docs
BioPhoton Mar 11, 2024
81a97d7
refactor(example-plugins): adopt tests
BioPhoton Mar 11, 2024
9a9b8a8
wip
BioPhoton Mar 12, 2024
a05426b
fix tests
BioPhoton Mar 12, 2024
bb1588f
Merge remote-tracking branch 'origin/main' into examples-plugins-benc…
BioPhoton Mar 12, 2024
b9fefff
fix tests
BioPhoton Mar 12, 2024
205d1a6
fix
BioPhoton Mar 12, 2024
dd931a5
fix
BioPhoton Mar 12, 2024
c3deed0
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Mar 13, 2024
a404650
merge main
BioPhoton Mar 13, 2024
7ed9d6f
fix
BioPhoton Mar 13, 2024
14c826b
fix
BioPhoton Mar 14, 2024
79b15cf
fix
BioPhoton Mar 14, 2024
e71c6db
fix
BioPhoton Mar 14, 2024
7e803b0
fix
BioPhoton Mar 14, 2024
0c2399a
fix
BioPhoton Mar 14, 2024
9c347df
fix
BioPhoton Mar 14, 2024
b6c5614
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Mar 27, 2024
1f4c414
Update packages/utils/perf/README.md
BioPhoton Mar 27, 2024
f75bae3
Update tools/benchmark/docs/README.md
BioPhoton Mar 27, 2024
0c37651
Update examples/plugins/code-pushup.config.ts
BioPhoton Mar 27, 2024
a0e6957
refactor(examples-plugins): fix lint
BioPhoton Mar 27, 2024
6ca47b1
Update packages/utils/project.json
BioPhoton Mar 27, 2024
fab6952
refactor(examples-plugins): rename const
BioPhoton Mar 27, 2024
00c9396
refactor(examples-plugins): adjust test timing
BioPhoton Mar 27, 2024
eed8329
refactor(examples-plugins): rename exports
BioPhoton Mar 27, 2024
c6b0cd2
refactor(examples-plugins): rename file
BioPhoton Mar 27, 2024
72375fa
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Mar 27, 2024
01d6306
Update packages/utils/perf/score-report/index.ts
BioPhoton Mar 31, 2024
93cc673
Update packages/utils/perf/crawl-file-system/index.ts
BioPhoton Mar 31, 2024
3234626
renamed folder and plugin
BioPhoton Mar 31, 2024
efc5d56
remove perfect score
BioPhoton Mar 31, 2024
ce49ba7
fix lint
BioPhoton Mar 31, 2024
163e7c0
fix tests
BioPhoton Mar 31, 2024
9b93cef
switch to sync perf testing
BioPhoton Mar 31, 2024
cf49393
edit timeout
BioPhoton Mar 31, 2024
81d46f8
adopt long running tests
BioPhoton Mar 31, 2024
16396ef
refactor tests
BioPhoton Mar 31, 2024
93b41dd
fix lint
BioPhoton Mar 31, 2024
1f51be1
fix lint and test timeouts
BioPhoton Apr 1, 2024
3f1cc2d
fix tests
BioPhoton Apr 1, 2024
3f207a3
fix tests
BioPhoton Apr 1, 2024
3fc9e52
wip
BioPhoton Apr 2, 2024
2980545
wip
BioPhoton Apr 2, 2024
47aeb66
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Apr 10, 2024
a83b487
cleanup
BioPhoton Apr 10, 2024
db1aaf5
cleanup
BioPhoton Apr 10, 2024
cf7a657
cleanup
BioPhoton Apr 10, 2024
ca46467
cleanup
BioPhoton Apr 10, 2024
e50d7e8
Update examples/plugins/src/js-benchmarking/README.md
BioPhoton Apr 14, 2024
f94a726
fix(example-plugins): adjust deps
BioPhoton Apr 14, 2024
47ce92f
Merge branch 'main' into examples-plugins-benchmark-js
BioPhoton Apr 14, 2024
e350246
edit link in readme
BioPhoton Apr 14, 2024
9fd6104
fix config
BioPhoton Apr 14, 2024
1726960
format config
BioPhoton Apr 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions code-pushup.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import 'dotenv/config';
import { join } from 'node:path';
import { z } from 'zod';
import {
JS_BENCHMARKING_PLUGIN_SLUG,
JS_BENCHMARKING_TINYBENCH_RUNNER_PATH,
fileSizePlugin,
fileSizeRecommendedRefs,
jsBenchmarkingPlugin,
jsBenchmarkingSuiteNameToCategoryRef,
packageJsonDocumentationGroupRef,
packageJsonPerformanceGroupRef,
packageJsonPlugin,
Expand Down Expand Up @@ -31,6 +36,8 @@ const envSchema = z
.partial();
const env = await envSchema.parseAsync(process.env);

const benchmarkJsSuiteNames = ['score-report'];

const config: CoreConfig = {
...(env.CP_SERVER &&
env.CP_API_KEY &&
Expand Down Expand Up @@ -78,6 +85,15 @@ const config: CoreConfig = {
}),

await lighthousePlugin('https://codepushup.dev/'),

await jsBenchmarkingPlugin({
tsconfig: join('packages', 'utils', 'tsconfig.perf.ts'),
runnerPath: JS_BENCHMARKING_TINYBENCH_RUNNER_PATH,
outputDir: join('.code-pushup', JS_BENCHMARKING_PLUGIN_SLUG),
targets: benchmarkJsSuiteNames.map(suit =>
join('packages', 'utils', 'perf', suit, 'index.ts'),
),
}),
],

categories: [
Expand Down Expand Up @@ -168,6 +184,7 @@ const config: CoreConfig = {
...fileSizeRecommendedRefs,
packageJsonPerformanceGroupRef,
packageJsonDocumentationGroupRef,
...benchmarkJsSuiteNames.map(jsBenchmarkingSuiteNameToCategoryRef),
],
},
],
Expand Down
12 changes: 12 additions & 0 deletions examples/plugins/code-pushup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
LIGHTHOUSE_OUTPUT_FILE_DEFAULT,
fileSizePlugin,
fileSizeRecommendedRefs,
jsBenchmarkingPlugin,
jsBenchmarkingSuiteNameToCategoryRef,
lighthouseCorePerfGroupRefs,
lighthousePlugin,
packageJsonDocumentationGroupRef,
Expand All @@ -20,6 +22,9 @@ import {
*
*/

const projectRoot = join('examples', 'plugins');
const benchmarkJsSuiteNames = ['dummy-suite'];

const config = {
plugins: [
fileSizePlugin({
Expand All @@ -42,6 +47,12 @@ const config = {
headless: false,
verbose: true,
}),
await jsBenchmarkingPlugin({
targets: benchmarkJsSuiteNames.map(folder =>
join(projectRoot, 'perf', folder, 'index.ts'),
),
tsconfig: join(projectRoot, 'tsconfig.perf.json'),
}),
],
categories: [
{
Expand All @@ -51,6 +62,7 @@ const config = {
...fileSizeRecommendedRefs,
packageJsonPerformanceGroupRef,
...lighthouseCorePerfGroupRefs,
...benchmarkJsSuiteNames.map(jsBenchmarkingSuiteNameToCategoryRef),
],
},
{
Expand Down
3 changes: 3 additions & 0 deletions examples/plugins/perf/dummy-suite/factorial.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function factorial(n: number): number {
return n === 0 || n === 1 ? 1 : n * factorial(n - 1);
}
71 changes: 71 additions & 0 deletions examples/plugins/perf/dummy-suite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import yargs from 'yargs';
import type { SuiteConfig } from '../../src/js-benchmarking/src/runner/types';
import { factorial } from './factorial';

const cli = yargs(process.argv).options({
numCases: {
type: 'number',
default: 2,
},
executionTime: {
type: 'number',
default: 0,
},
executionTimeDiff: {
type: 'number',
default: 0,
},
syncIterations: {
type: 'number',
default: 500,
},
syncIterationsDiff: {
type: 'number',
default: 1000,
},
logs: {
type: 'boolean',
default: false,
},
});

const {
numCases,
executionTime,
executionTimeDiff,
syncIterations,
syncIterationsDiff,
logs, // eslint-disable-next-line n/no-sync
} = cli.parseSync();

if (logs) {
// eslint-disable-next-line no-console
console.log('You can adjust the test with the following arguments:');
// eslint-disable-next-line no-console
console.log(
`numCases number of test cases --numCases=${numCases.toString()}`,
`executionTime duration of first case in ms --executionTime=${executionTime.toString()}`,
`executionTimeDiff time diff in execution duration in ms --executionTimeDiff=${executionTimeDiff.toString()}`,
`syncIterations executions of dummy fn factorial --syncIterations=${syncIterations.toString()}`,
`syncIterationsDiff diff in number of executions --syncIterationsDiff=${syncIterationsDiff.toString()}`,
);
}

// ==================

const suiteConfig: SuiteConfig = {
suiteName: 'dummy-suite',
targetImplementation: 'case-1',
cases: Array.from({ length: numCases }).map((_, idx) => [
`case-${idx + 1}`,
() =>
new Promise(resolve =>
setTimeout(() => {
resolve(factorial((syncIterations + syncIterationsDiff) * idx));
}, executionTime + executionTimeDiff * idx),
),
]),
time: executionTime + executionTimeDiff * 2,
};

export default suiteConfig;
10 changes: 9 additions & 1 deletion examples/plugins/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
"main": "examples/plugins/src/index.ts",
"tsConfig": "examples/plugins/tsconfig.lib.json",
"assets": ["examples/plugins/*.md"],
"esbuildConfig": "esbuild.config.js"
"esbuildConfig": "esbuild.config.js",
"additionalEntryPoints": [
"examples/plugins/src/js-benchmarking.benchmark.runner.ts",
"examples/plugins/src/js-benchmarking.benny.runner.ts",
"examples/plugins/src/js-benchmarking.tinybench.runner.ts"
]
}
},
"lint": {
Expand Down Expand Up @@ -70,6 +75,9 @@
"target": "build"
}
]
},
"perf": {
"command": "node tools/benchmark/bin.mjs --targets ./examples/plugins/perf/dummy-suite/index.ts"
}
},
"tags": ["scope:internal", "type:feature"]
Expand Down
10 changes: 10 additions & 0 deletions examples/plugins/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ export {
LIGHTHOUSE_OUTPUT_FILE_DEFAULT,
recommendedRefs as lighthouseCorePerfGroupRefs,
} from './lighthouse/src/index';
export {
jsBenchmarkingPlugin,
jsBenchmarkingSuiteNameToCategoryRef,
JsBenchmarkingPluginConfig,
JS_BENCHMARKING_PLUGIN_SLUG,
JS_BENCHMARKING_BENCHMARK_RUNNER_PATH,
JS_BENCHMARKING_BENNY_RUNNER_PATH,
JS_BENCHMARKING_TINYBENCH_RUNNER_PATH,
JS_BENCHMARKING_DEFAULT_RUNNER_PATH,
} from './js-benchmarking/src/index';
3 changes: 3 additions & 0 deletions examples/plugins/src/js-benchmarking.benchmark.runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { benchmarkRunner } from './js-benchmarking/src/runner/benchmark.suite-runner';

export default benchmarkRunner;
3 changes: 3 additions & 0 deletions examples/plugins/src/js-benchmarking.benny.runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { bennyRunner } from './js-benchmarking/src/runner/benny.suite-runner';

export default bennyRunner;
3 changes: 3 additions & 0 deletions examples/plugins/src/js-benchmarking.tinybench.runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { tinybenchRunner } from './js-benchmarking/src/runner/tinybench.suite-runner';

export default tinybenchRunner;
132 changes: 132 additions & 0 deletions examples/plugins/src/js-benchmarking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# benchmark js example

🕵️️ **Code PushUp plugin to benchmark JS execution performance** 📊

---

The plugin analyzes a given suite name and creates benchmark audits.
It uses [tinybench](https://github.com/tinylibs/tinybench) under the hood.

You can configure the plugin with the following options:

- `targets` - files to load that export a suite
- `tsconfig` - path to tsconfig file _(optional)_
- `logs` - additional information _(optional)_

## Getting started

1. If you haven't already, install [@code-pushup/cli](../../../../packages/cli/README.md) and create a configuration file.

2. Copy the [plugin source](./src/) as is into your project

3. Add this plugin to the `plugins` array in your Code PushUp CLI config file (e.g. `code-pushup.config.js`).

Pass in the path on the directory to load the test suite form (relative to `process.cwd()`), for more options see [BenchmarkJsPluginOptions]().

```js
import { join } from 'node:path';
import benchmarkJsPlugin from './benchmark-js.plugin';

export default {
// ...
plugins: [
// ...
await benchmarkJsPlugin({
targets: ['suites/score-report.ts'],
}),
],
};
```

1. Create benchmark suite:

```ts
// typescript
const suiteConfig = {
suiteName: 'glob',
targetImplementation: 'version-2',
cases: [
['version-1', () => new Promise(resolve => setTimeout(resolve, 30))],
['version-2', () => new Promise(resolve => setTimeout(resolve, 10))],
['version-3', () => new Promise(resolve => setTimeout(resolve, 20))],
],
};
```

4. (Optional) Set up categories (use `npx code-pushup print-config` to list audits and groups).

```js
import benchmarkJsPlugin, { suitesToCategorieGroupRef } from './benchmark-js.plugin';

export default {
// ...
categories: [
// ...
{
slug: 'performance',
title: 'Performance',
refs: suitesToCategorieGroupRef(suites),
},
],
};
```

5. Run the CLI with `npx code-pushup collect` and view or upload report (refer to [CLI docs](../../../../packages/cli/README.m)).

For a standalone usage uf the test runner use our helpers

## Audits

The plugin creates an audit for each suite.

The audit scoring is based on fastest case, that means the fastest audit has a score of 100.
If the target implementation is not the fastest, the audit shows how much slower the target implementation is compared to the fastest.

`● crawl-file-system - Benchmark JS 59.9 ops/sec`

### Issues

Each audit has the test cases listed as issue.

**Possible issues:**

- is slower - `version-1 59.90 ops/sec (20% slower)`
- is target and slower - `🎯 version-1 59.90 ops/sec (20% slower)`
- is fastest - `version-1 59.90 ops/sec 🔥 `
- is target and fastest - `🎯 version-1 59.90 ops/sec 🔥`

<img width="600px" src="./docs/images/audits-readme-example.png">

## Standalone helper

The plugin also provides a helper function to execute a test suite.

```ts
import { SuiteConfig, runSuit } from './suite-helper.ts';

const suite: SuiteConfig = {
suiteName: 'dummy-suite',
targetImplementation: 'version-2',
cases: [
['version-1', async () => new Promise(resolve => setTimeout(resolve, 30))],
['version-2', async () => new Promise(resolve => setTimeout(resolve, 50))],
['version-3', async () => new Promise(resolve => setTimeout(resolve, 80))],
],
};
const results = await runSuite(suite);

const { suiteName, name, hz: maxHz } = results.find(({ isFastest }) => isFastest);
const target = results.find(({ isTarget }) => isTarget);
console.log(`In suite ${suiteName} fastest is: ${name} target is ${target?.name}`);
console.table(
results.map(({ name, hz, rme, samples, isTarget, isFastest }) => {
const targetIcon = isTarget ? '🎯' : '';
const postfix = isFastest ? '(fastest 🔥)' : `(${((1 - hz / maxHz) * 100).toFixed(1)}% slower)`;
return {
// fast-glob x 40,824 ops/sec ±4.44% (85 runs sampled)
message: `${targetIcon}${name} x ${hz.toFixed(2)} ops/sec ±${rme.toFixed(2)}; ${samples} samples ${postfix}`,
severity: hz < maxHz && isTarget ? 'error' : 'info',
};
}),
);
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions examples/plugins/src/js-benchmarking/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { z } from 'zod';
import { JS_BENCHMARKING_DEFAULT_RUNNER_PATH } from './constants';

export const jsBenchmarkingRunnerOptionsSchema = z.object({
runnerPath: z.string().default(JS_BENCHMARKING_DEFAULT_RUNNER_PATH),
tsconfig: z.string().optional(),
outputDir: z.string().optional(),
outputFileName: z.string().optional(),
verbose: z.boolean().optional(),
});

export const jsBenchmarkingPluginOptionsSchema = z.object({
targets: z.array(z.string()),
runnerPath: z.string().default(JS_BENCHMARKING_DEFAULT_RUNNER_PATH),
tsconfig: z.string().optional(),
outputDir: z.string().optional(),
verbose: z.boolean().optional(),
});

export type JsBenchmarkingPluginConfig = z.input<
typeof jsBenchmarkingPluginOptionsSchema
>;
21 changes: 21 additions & 0 deletions examples/plugins/src/js-benchmarking/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { join } from 'node:path';

export const JS_BENCHMARKING_PLUGIN_SLUG = 'js-benchmarking';

function withRunnerRoot(runnerName: string): string {
// @TODO replace with `@code-pushup/js-benchmarking-plugin/src/runner/`
return join(
'dist',
'examples',
'plugins',
`${JS_BENCHMARKING_PLUGIN_SLUG}.${runnerName}.runner.js`,
);
}

export const JS_BENCHMARKING_TINYBENCH_RUNNER_PATH =
withRunnerRoot('tinybench');
export const JS_BENCHMARKING_BENCHMARK_RUNNER_PATH =
withRunnerRoot('benchmark');
export const JS_BENCHMARKING_BENNY_RUNNER_PATH = withRunnerRoot('benny');
export const JS_BENCHMARKING_DEFAULT_RUNNER_PATH =
JS_BENCHMARKING_TINYBENCH_RUNNER_PATH;
Loading