@abide/harness 0.6.0 → 0.7.0
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/package.json +2 -2
- package/scripts/buildInjectable.ts +5 -0
- package/src/engine/shares.ts +1 -2
- package/src/measure/install.ts +3 -4
- package/src/runner/index.ts +1 -1
- package/src/runner/runBenches.ts +16 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abide/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ratios against hand-written code, counts of the work an op did, and gates whose revert can be run — three measurement lanes for anything that renders, on bun",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@playwright/test": "^1.64.0",
|
|
60
|
-
"@abide/abide": ">=0.
|
|
60
|
+
"@abide/abide": ">=0.143.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependenciesMeta": {
|
|
63
63
|
"@playwright/test": {
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
// `__HARNESS_MEASURE__` off the page. Built in memory rather than into `dist/`: every
|
|
8
8
|
// spec loads in both engine projects at once, and two workers writing one file is a
|
|
9
9
|
// reader that can catch it half-written.
|
|
10
|
+
//
|
|
11
|
+
// A SCRIPT, NOT AN ENTRY: abide's browser specs import it by path, and it stays out of `exports`
|
|
12
|
+
// because no app measuring itself injects a lane by hand — `@abide/harness/abide`'s preload does
|
|
13
|
+
// that for one — so an entry would be public surface, with its clauses and its pages, for this
|
|
14
|
+
// repo's specs alone.
|
|
10
15
|
|
|
11
16
|
import type { Page } from '@playwright/test'
|
|
12
17
|
|
package/src/engine/shares.ts
CHANGED
|
@@ -29,8 +29,7 @@ export type Shares = {
|
|
|
29
29
|
/**
|
|
30
30
|
* The share, which is also the CPU ceiling.
|
|
31
31
|
*
|
|
32
|
-
* An optimization is capped by the fraction of the op it touches.
|
|
33
|
-
* sketch returned the fraction twice, once as `layer` and once as `ceilingCpu`.
|
|
32
|
+
* An optimization is capped by the fraction of the op it touches.
|
|
34
33
|
*/
|
|
35
34
|
ceilingCpu: number
|
|
36
35
|
/**
|
package/src/measure/install.ts
CHANGED
|
@@ -428,10 +428,9 @@ function counting(
|
|
|
428
428
|
original: AnyFunction,
|
|
429
429
|
): AnyFunction {
|
|
430
430
|
return function (this: unknown, ...args: unknown[]): unknown {
|
|
431
|
-
// Nested inside an already-counted call
|
|
432
|
-
//
|
|
433
|
-
if (depth > 0) return original.apply(this, args)
|
|
434
|
-
if (!armed) return original.apply(this, args)
|
|
431
|
+
// Nested inside an already-counted call, the outermost one has already said what this
|
|
432
|
+
// op did.
|
|
433
|
+
if (depth > 0 || !armed) return original.apply(this, args)
|
|
435
434
|
depth = 1
|
|
436
435
|
try {
|
|
437
436
|
tallyBefore(role, this, args, member)
|
package/src/runner/index.ts
CHANGED
package/src/runner/runBenches.ts
CHANGED
|
@@ -4,6 +4,21 @@ import { type Batched, claimOf, ratio } from '../report/index.ts'
|
|
|
4
4
|
export const milliseconds = (nanoseconds: number) =>
|
|
5
5
|
`${(nanoseconds / 1e6).toFixed(3)} ms`
|
|
6
6
|
|
|
7
|
+
/** One bench `runBenches` ran: its file, its case, and each arm's time per operation. */
|
|
8
|
+
export type Bench = {
|
|
9
|
+
file: string
|
|
10
|
+
name: string
|
|
11
|
+
case: string
|
|
12
|
+
n: number
|
|
13
|
+
floor: number
|
|
14
|
+
/** Nanoseconds per operation, by arm. */
|
|
15
|
+
arms: Record<string, number>
|
|
16
|
+
/** The last arm over the first, as the harness is allowed to say it; '' for one arm. */
|
|
17
|
+
claim: string
|
|
18
|
+
/** An arm over its ceiling, and a ceiling naming no arm or no bench. */
|
|
19
|
+
over: string[]
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
/**
|
|
8
23
|
* Every bench beside the code, `src/**\/*.bench.ts` under `root`, run in this process one after
|
|
9
24
|
* another: each function a file exports is one bench, and its `CEILINGS` names the most each arm
|
|
@@ -15,21 +30,7 @@ export const milliseconds = (nanoseconds: number) =>
|
|
|
15
30
|
export async function runBenches(
|
|
16
31
|
root: string,
|
|
17
32
|
only?: string,
|
|
18
|
-
): Promise<
|
|
19
|
-
{
|
|
20
|
-
file: string
|
|
21
|
-
name: string
|
|
22
|
-
case: string
|
|
23
|
-
n: number
|
|
24
|
-
floor: number
|
|
25
|
-
/** Nanoseconds per operation, by arm. */
|
|
26
|
-
arms: Record<string, number>
|
|
27
|
-
/** The last arm over the first, as the harness is allowed to say it; '' for one arm. */
|
|
28
|
-
claim: string
|
|
29
|
-
/** An arm over its ceiling, and a ceiling naming no arm or no bench. */
|
|
30
|
-
over: string[]
|
|
31
|
-
}[]
|
|
32
|
-
> {
|
|
33
|
+
): Promise<Bench[]> {
|
|
33
34
|
const base = root.endsWith('/') ? root : `${root}/`
|
|
34
35
|
const files = [...new Bun.Glob('src/**/*.bench.ts').scanSync(base)].sort()
|
|
35
36
|
const benches = []
|