diff --git a/bench/README.md b/bench/README.md index ef4ef0333e6..606d42f85dc 100644 --- a/bench/README.md +++ b/bench/README.md @@ -497,7 +497,7 @@ reconnects x 64 characters, and keeps its run directory as the `bench-browser` artifact. The in-memory frame, retained-history, gap ledger, bandwidth allocation, cached-group -replay, resume-history, and buffered-group paths also run directly in Chromium: +replay, resume-history, buffered-group, and peer grant paths also run directly in Chromium: ```bash nix develop --command bun bench/browser/micro.ts --bench frames --out .tmp/frames.json base=/path/to/release current=. aa=. @@ -507,6 +507,7 @@ nix develop --command bun bench/browser/micro.ts --bench bandwidth --out .tmp/ba nix develop --command bun bench/browser/micro.ts --bench replay --out .tmp/replay.json before=/path/to/main current=. aa=. nix develop --command bun bench/browser/micro.ts --bench resume-history --out .tmp/resume-history.json before=/path/to/main current=. aa=. nix develop --command bun bench/browser/micro.ts --bench buffered --out .tmp/buffered.json before=/path/to/main current=. aa=. +nix develop --command bun bench/browser/micro.ts --bench pattern --out .tmp/pattern.json before=/path/to/main current=. aa=. ``` Each variant uses its own workspace source and a persistent, cross-origin isolated @@ -527,6 +528,9 @@ change, a demand change and a ceiling change until the allocator republishes, an peek of every reservation, checking every grant against a reference division. Its Rust counterpart is `cargo bench -p moq-net --features fuzz --bench bandwidth`, whose `BANDWIDTH_COUNTS=` mode prints allocations and wakes per operation. +`pattern` runs `js/pattern/bench/algebra.ts` against every checkout's `@moq/pattern`: +the same peer grant shapes as the Rust `pattern-algebra` sweep below, reduced and +compared against a previous grant, up to a whole `AUTH_OK`. The drift sweep includes untimed controls and timed groups with decode-order B-frames, independently varying publisher and reader counts and retained history. Its `time_mode` column is 0 for untimed, 1 for millisecond timestamps, and 2 @@ -570,14 +574,16 @@ route hold, from Chromium's precise memory info; `serve_us` and `read_us` include no setup. Bun's collector scans its stack conservatively, so the fixture refuses to run there. -The browser smoke lane preserves one measured round of all seven fixtures, and drift, -ledger, bandwidth, replay and buffered also run in the nightly JS benchmark leg. Timing is +The browser smoke lane preserves one measured round of all eight fixtures, and drift, +ledger, bandwidth, replay, buffered and pattern also run in the nightly JS benchmark leg. Timing is observational, with the A/A spread showing the host's noise floor. ## Pattern and container coverage Rust Criterion coverage includes `moq-pattern`'s -`matching` (pattern count and path depth, last match and miss) and `moq-mux`'s +`matching` (pattern count and path depth, last match and miss; and, in +`pattern-algebra`, whole-union operations, including the worst known peer grant +shapes swept over encoded size up to a whole `AUTH_OK`) and `moq-mux`'s `containers` (CMAF and Annex-B import/export). Container cases vary frame count and payload size; CMAF also varies track count. Separate frame and byte rates use the same fixtures, with byte rates counting the encoded stream size. diff --git a/bench/browser/micro.ts b/bench/browser/micro.ts index e993dfcd245..18a7327b7d1 100644 --- a/bench/browser/micro.ts +++ b/bench/browser/micro.ts @@ -24,6 +24,7 @@ const benchmarks: Record = { replay: { entry: "js/net/bench/replay.ts", rows: 72 }, "resume-history": { entry: "js/net/bench/resume-history.ts", rows: 72 }, buffered: { entry: "js/hang/bench/buffered.ts", rows: 36 }, + pattern: { entry: "js/pattern/bench/algebra.ts", rows: 12 }, }; const selected = Object.hasOwn(benchmarks, benchmark) ? benchmarks[benchmark] : undefined; if (!selected) throw new Error(`--bench must be one of: ${Object.keys(benchmarks).join(", ")}`); @@ -55,7 +56,9 @@ for (const [name, root] of roots) { importer.endsWith(`/${dir}/${benchmark}.ts`) ? { path: resolve(root, dir, path) } : undefined, ); build.onLoad( - { filter: /\/bench\/(frames|drift|ledger|bandwidth|replay|resume-history|buffered)\.ts$/ }, + { + filter: /\/bench\/(frames|drift|ledger|bandwidth|replay|resume-history|buffered|algebra)\.ts$/, + }, async ({ path }) => { const source = await Bun.file(path).text(); if (benchmark !== "frames") diff --git a/bench/browser/run.sh b/bench/browser/run.sh index 596d8b9d0ee..d3d4ab0b50e 100755 --- a/bench/browser/run.sh +++ b/bench/browser/run.sh @@ -88,7 +88,7 @@ bun install --frozen-lockfile cd "$HERE" # The in-memory paths share Chromium installation and artifact retention with this lane. -for benchmark in frames drift ledger bandwidth replay resume-history buffered; do +for benchmark in frames drift ledger bandwidth replay resume-history buffered pattern; do bun micro.ts --bench "$benchmark" --rounds 1 --out "$HARNESS_RUN/$benchmark.json" \ current="$WORKSPACE" aa="$WORKSPACE" done diff --git a/js/justfile b/js/justfile index fbc65ad98f9..3f3a5cacb69 100644 --- a/js/justfile +++ b/js/justfile @@ -122,6 +122,12 @@ arrivals-bench: bun install --frozen-lockfile bun watch/bench/arrivals.ts +# Reduce and compare the worst known peer grant shapes, swept over AUTH_OK size. +pattern-bench: + bun install --frozen-lockfile + bunx tsc --noEmit --project pattern/bench/tsconfig.json + bun pattern/bench/algebra.ts + # Sweep manual-clock armed timers x due timers, with independent and shared abort scopes. clock-bench: bun install --frozen-lockfile diff --git a/js/net/src/auth_session.ts b/js/net/src/auth_session.ts index 8df4df55918..5a1af021d2b 100644 --- a/js/net/src/auth_session.ts +++ b/js/net/src/auth_session.ts @@ -105,7 +105,7 @@ export interface AuthWire { unsupported(stream: Stream, reason: string): Promise; } -/** The paths any of `grants` allows. Reduced once, so it costs about the grants' total size. */ +/** The paths any of `grants` allows. Reduced once over all of them, not pairwise. */ function union(grants: Iterable): Grant { const publish: Path.Pattern[] = []; const subscribe: Path.Pattern[] = []; diff --git a/js/pattern/bench/algebra.ts b/js/pattern/bench/algebra.ts new file mode 100644 index 00000000000..3d90ffa2f64 --- /dev/null +++ b/js/pattern/bench/algebra.ts @@ -0,0 +1,92 @@ +/** + * Reduce and compare a peer grant shaped against the union index, swept over its encoded size + * up to a whole AUTH_OK. Mirrors the Shape cases of the Rust `pattern-algebra` benchmark. + */ +import { Pattern, Patterns } from "@moq/pattern"; + +/** The largest moq-lite control message, and so the largest AUTH_OK. */ +const MAX_MESSAGE = 65535; + +/** Positions a mask chooses `*` or `y` for, half of them `*`. */ +const FREE = 14; + +/** A varint's size as AUTH_OK writes counts and lengths; QUIC's, never smaller than lite's. */ +function varint(value: number): number { + return value < 64 ? 1 : value < 16384 ? 2 : 4; +} + +/** A union's encoded size as AUTH_OK carries it: a count, then each text with its length. */ +function wire(texts: string[]): number { + return texts.reduce((size, text) => size + varint(text.length) + text.length, varint(texts.length)); +} + +/** + * The grant's texts, filling at most `bytes` encoded, and a previous grant covering every one, + * as a regrant compares them. Every member is incomparable, so reduction keeps them all. + * + * `mask` pairs `*`/`y` masks of equal weight, each ending in `y`, with literal `y/…/y/xNNNN` + * queries that every mask matches but for the last segment. `chain` is the correlated partials + * `a^i*z^(n-i)`, each sharing prefixes and suffixes with all the others. + */ +function grant(shape: "mask" | "chain", bytes: number): { texts: string[]; previous: Patterns } { + const parse = (texts: string[]) => new Patterns(texts.map((text) => Pattern.parse(text))); + if (shape === "chain") { + const chain = (n: number) => + Array.from({ length: n - 1 }, (_, i) => `${"a".repeat(i + 1)}*${"z".repeat(n - i - 1)}`); + let n = 2; + while (wire(chain(n + 1)) <= bytes) n++; + const texts = chain(n); + return { texts, previous: parse(texts) }; + } + const masks: string[] = []; + const queries: string[] = []; + let size = 0; + for (let bits = 0, index = 0; bits < 1 << FREE; bits++) { + let weight = 0; + for (let at = 0; at < FREE; at++) weight += (bits >> at) & 1; + if (weight !== FREE / 2) continue; + const mask = [...Array.from({ length: FREE }, (_, at) => ((bits >> at) & 1 ? "*" : "y")), "y"].join("/"); + const query = `${Array(FREE).fill("y").join("/")}/x${String(index++).padStart(4, "0")}`; + size += varint(mask.length) + mask.length + varint(query.length) + query.length; + if (varint(masks.length * 2 + 2) + size > bytes) break; + masks.push(mask); + queries.push(query); + } + // `*/…/*/x*` holds every query, and a walk tries a literal before `*`, so each query + // reaches it only after every mask. + const previous = parse([...masks, `${Array(FREE).fill("*").join("/")}/x*`]); + return { texts: [...masks, ...queries], previous }; +} + +/** Time each shape's reduction and regrant comparison, repeated to at least 100 ms per row. */ +export function run(): void { + console.log("bytes,shape,op,members,ms_per_op"); + for (const shape of ["mask", "chain"] as const) { + for (const bytes of [4096, 16384, MAX_MESSAGE]) { + const { texts, previous } = grant(shape, bytes); + const size = wire(texts); + if (size > bytes || size * 16 <= bytes * 15) throw new Error(`${shape} fills ${size} of ${bytes} bytes`); + const message = texts.map((text) => Pattern.parse(text)); + const reduced = new Patterns(message); + if (reduced.size !== message.length) throw new Error(`${shape} members are not incomparable`); + if (!previous.covers(reduced)) throw new Error(`${shape} previous grant does not cover it`); + const ops: [string, () => unknown][] = [ + ["collect", () => new Patterns(message).size], + ["covers", () => previous.covers(reduced)], + ]; + for (const [op, body] of ops) { + let iterations = 0; + const start = performance.now(); + let elapsed = 0; + while (elapsed < 100 || iterations < 3) { + body(); + iterations++; + elapsed = performance.now() - start; + } + console.log(`${bytes},${shape},${op},${message.length},${(elapsed / iterations).toFixed(3)}`); + } + } + } +} + +if (import.meta.main) run(); diff --git a/js/pattern/bench/tsconfig.json b/js/pattern/bench/tsconfig.json new file mode 100644 index 00000000000..127a2e04490 --- /dev/null +++ b/js/pattern/bench/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "..", + "noEmit": true + }, + "include": ["*.ts"] +} diff --git a/js/pattern/package.json b/js/pattern/package.json index 6dde31ad6c7..a5b9896c30e 100644 --- a/js/pattern/package.json +++ b/js/pattern/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "rm -rf dist && tsc -b tsconfig.build.json && bun ../common/package.ts", - "check": "tsc --noEmit", + "check": "tsc --noEmit && tsc --noEmit --project bench/tsconfig.json", "test": "bun test --only-failures", "release": "bun ../common/release.ts" }, diff --git a/js/pattern/src/index.ts b/js/pattern/src/index.ts index 3d736b618f9..baf6b1a3f4a 100644 --- a/js/pattern/src/index.ts +++ b/js/pattern/src/index.ts @@ -1054,8 +1054,9 @@ function bounded(patterns: Iterable): Pattern[] { * * Operations over a whole union (construction, {@link Patterns.covers}, and * {@link Patterns.intersect}) index one side by segment first, so their cost follows the - * members a query could match rather than every pair: a peer's large grant costs about its - * own size, not its square. + * members a query could match rather than every pair. That keeps common grants near their own + * size, but containment between wildcard patterns reduces to Orthogonal Vectors, so some shapes + * stay super-linear (the `mask` and `chain` cases in `bench/algebra.ts`). * * @public */ diff --git a/quest/m2/peer-grant-bound.md b/quest/m2/peer-grant-bound.md index 3adb55dc01b..db47bc0a0ef 100644 --- a/quest/m2/peer-grant-bound.md +++ b/quest/m2/peer-grant-bound.md @@ -6,31 +6,57 @@ A peer's `AUTH_OK` costs near-linear time in its bytes on every input shape, in Rust and JS, including a regrant compared against the previous grant. Measure JS in a browser, not node or bun. +Re-matching live routes after a regrant is out of scope; it is +[its own quest](/quest/m2/regrant-route-recheck.md). + ## Plan [moq-dev/moq#6356](https://github.com/moq-dev/moq/pull/6356) indexed whole-union operations in `moq-pattern` and `@moq/pattern` by segment. That -made every benchmarked shape linear, but the worst case is still about -25 ms per 64 KiB message in Rust. The shape is 1024 incomparable `*`/`a` -masks against literal queries that fail only at the last segment. Containment -between patterns with wildcards reduces to Orthogonal Vectors, so no index -closes that gap. Correlated partials (`a^i*z^(n-i)`) cost 8.6 ms, growing as -bytes^1.5 (see the -[Codex thread](https://github.com/moq-dev/moq/pull/6356#discussion_r4352967969)). - -Candidate approaches, needing a fresh `/quest-plan`: - -- Keep peer grants unreduced: decode into a sorted, deduplicated list in - O(n log n), and make `Permit::covers` syntactic (its docs already allow a - spurious false). This changes what `Patterns` or `Grant` promise about - equality and canonical form, so it is an API decision. -- A joint prefix/suffix index for partial segments (rectangle stabbing on - trie traversal order). This removes the correlated-partial chain but not - the segment-level floor. - -Prove it with the `pattern-algebra` benchmark extended by the mask and -partial-chain shapes, each sweeping message size. +made every benchmarked shape linear, but containment between patterns with +wildcards reduces to Orthogonal Vectors, so no index closes the gap. +[moq-dev/moq#7536](https://github.com/moq-dev/moq/pull/7536) added the +`pattern-algebra` cases (Rust Criterion) and `js/pattern/bench/algebra.ts` +(Chromium through `bench/browser/micro.ts --bench pattern`) that sweep the two +worst known shapes over message size up to a whole `AUTH_OK`: + +- `mask`: equal-weight `*`/`y` masks beside literal queries that fail only at + the last segment. At 64 KiB one reduction costs about 40 ms in Rust and + 250 ms in Chromium, growing as bytes^1.7. +- `chain`: correlated partials `a^i*z^(n-i)`. At 64 KiB about 9 ms in Rust and + 24 ms in Chromium, growing as bytes^1.3. + +Each `AUTH_OK` pays this more than once: Rust reduces on decode +(`Patterns::decode`) and again in `Grant::union`, then every moq-lite announce +stream's regrant runs `Permit::covers` (the same walk) against its previous +permit. JS reduces on decode (`decodePatterns`) and in `union`. + +Decided 2026-11-01 (maintainer, on #7536): + +- ✅ Keep received grants unreduced, in their own type. `AUTH_OK` decodes into + a sorted, deduplicated pattern list in O(n log n). The union of received + grants is a merge, and equality and `Permit::covers` become syntactic + (`Permit::covers` already allows a spurious false, which only re-reads the + origin once). Matching stays O(members) per path. `Patterns` keeps its + reduced, set-equality promise for the grants this side issues and verifies, + including moq-auth's `granted.covers(requested)`. Rejected: weakening + `Patterns` everywhere (loses set equality, or splits `covers` into two + behaviors), a joint prefix/suffix index alone (leaves `mask` at bytes^1.7), + and refusing an `AUTH_OK` past a work budget (a runtime refusal by constant + that changes wire behavior for valid grants). +- ✅ The regrant's route re-match is a follow-up quest, not this one. + +Open, for a `/quest-plan` before implementation: the received-grant type's +name and crate, and whether `Grant` splits into issued and received types +(today one `Grant` serves `Handle::grant()` and `Credential::grant` as well as +`Request::accept`, `Issued::update`, and `Handle::authorize`, in Rust and in +`@moq/net`). Either is a breaking change to the received side's API. + +Prove it with the same benches: the received-grant decode, union, and +`Permit::covers` swept over the `mask` and `chain` shapes, linear in bytes, +before and after. ## Related +- [A regrant re-checks only the routes it can change](/quest/m2/regrant-route-recheck.md) - the route fan-out after a regrant, which this leaves alone; whichever lands second adapts to the other - [Fair share across broadcasts](/quest/m2/broadcast-fairness.md) - the other per-session CPU and bandwidth fairness concern diff --git a/rs/moq-net/src/auth.rs b/rs/moq-net/src/auth.rs index 0b712710ca2..30ad48286c7 100644 --- a/rs/moq-net/src/auth.rs +++ b/rs/moq-net/src/auth.rs @@ -106,7 +106,7 @@ impl Grant { } /// The paths any of `grants` allows, lapsing at the earliest expiry, which is when - /// the union next shrinks. Reduced once, so it costs about the grants' total size. + /// the union next shrinks. Reduced once over all of them, not pairwise. fn union<'a>(grants: impl IntoIterator) -> Self { let mut publish = Vec::new(); let mut subscribe = Vec::new(); diff --git a/rs/moq-pattern/benches/matching.rs b/rs/moq-pattern/benches/matching.rs index c99b851ac8a..2b2f605bb39 100644 --- a/rs/moq-pattern/benches/matching.rs +++ b/rs/moq-pattern/benches/matching.rs @@ -49,6 +49,11 @@ fn matching(c: &mut Criterion) { /// succeed on every query to visit them all: per kind it queries a subset of the held /// union, and `covers-subtree` holds `sNNNN/**` members that cover any number of /// literals beneath them, so it sweeps both sizes. +/// +/// The [`Shape`] cases sweep one peer grant's encoded size up to a whole `AUTH_OK`: +/// `collect` reduces it as decoding does, and `covers` compares it against a previous +/// grant as a regrant does. Their throughput is bytes, so a cost that grows faster than +/// the message shows as falling throughput. fn algebra(c: &mut Criterion) { let mut group = c.benchmark_group("pattern-algebra"); let union = |kind: &str, name: &str, count: usize| -> Patterns { @@ -114,8 +119,118 @@ fn algebra(c: &mut Criterion) { b.iter(|| std::hint::black_box(subtrees.covers(&literals))); }); } + // Each iteration reduces a whole message, so fewer samples keep the sweep short. + group.sample_size(10); + for shape in [Shape::Mask, Shape::Chain] { + for bytes in [4096, 16384, MAX_MESSAGE] { + let (message, previous) = shape.grant(bytes); + let size = wire(&message); + assert!( + size <= bytes && size * 16 > bytes * 15, + "{shape:?} fills {size} of {bytes} bytes" + ); + let message: Vec = message.iter().map(|text| text.parse().unwrap()).collect(); + let reduced: Patterns = message.iter().cloned().collect(); + assert_eq!(reduced.len(), message.len(), "{shape:?} members are incomparable"); + assert!(previous.covers(&reduced)); + group.throughput(Throughput::Bytes(size as u64)); + group.bench_function(BenchmarkId::new(format!("collect-{}", shape.name()), bytes), |b| { + b.iter(|| std::hint::black_box(message.iter().cloned().collect::().len())); + }); + group.bench_function(BenchmarkId::new(format!("covers-{}", shape.name()), bytes), |b| { + b.iter(|| std::hint::black_box(previous.covers(&reduced))); + }); + } + } group.finish(); } +/// The largest moq-lite control message, and so the largest `AUTH_OK`. +const MAX_MESSAGE: usize = u16::MAX as usize; + +/// A QUIC varint's size, as `AUTH_OK` writes counts and lengths. +fn varint(value: usize) -> usize { + match value { + ..64 => 1, + ..16384 => 2, + _ => 4, + } +} + +/// A union's encoded size as `AUTH_OK` carries it: a count, then each text with its length. +fn wire(texts: &[String]) -> usize { + varint(texts.len()) + texts.iter().map(|text| varint(text.len()) + text.len()).sum::() +} + +/// A peer grant shaped against the union index, filling one message. +/// +/// Containment between patterns with wildcards reduces to Orthogonal Vectors, so some shape +/// costs more than linear time against any index; these are the two worst known against +/// this one. Every member is incomparable, so reduction keeps them all and visits each. +#[derive(Clone, Copy, Debug)] +enum Shape { + /// `*`/`y` masks of equal weight, each ending in `y`, beside literal `y/…/y/xNNNN` + /// queries that every mask matches but for the last segment. + Mask, + /// The correlated partials `a^i*z^(n-i)`, each sharing prefixes and suffixes with all + /// the others. + Chain, +} + +impl Shape { + /// Positions a mask chooses `*` or `y` for, half of them `*`. + const FREE: usize = 14; + + fn name(self) -> &'static str { + match self { + Self::Mask => "mask", + Self::Chain => "chain", + } + } + + /// The grant's texts, filling at most `bytes` encoded, and a previous grant covering + /// every one, as a regrant compares them. + fn grant(self, bytes: usize) -> (Vec, Patterns) { + let parse = |texts: &[String]| texts.iter().map(|text| text.parse::().unwrap()).collect(); + match self { + Self::Mask => { + let masks = (0u32..1 << Self::FREE) + .filter(|bits| bits.count_ones() as usize == Self::FREE / 2) + .map(|bits| { + let segments = (0..Self::FREE).map(|at| if bits >> at & 1 == 1 { "*" } else { "y" }); + segments.chain(["y"]).collect::>().join("/") + }); + let queries = (0..).map(|index| format!("{}/x{index:04}", ["y"; Self::FREE].join("/"))); + let (mut kept, mut asked) = (Vec::new(), Vec::new()); + let mut texts = 0; + for (mask, query) in masks.zip(queries) { + texts += varint(mask.len()) + mask.len() + varint(query.len()) + query.len(); + if varint(2 * kept.len() + 2) + texts > bytes { + break; + } + kept.push(mask); + asked.push(query); + } + // `*/…/*/x*` holds every query, and a walk tries a literal before `*`, so each + // query reaches it only after every mask. + let previous = parse(&[kept.clone(), vec![format!("{}/x*", ["*"; Self::FREE].join("/"))]].concat()); + kept.extend(asked); + (kept, previous) + } + Self::Chain => { + let chain = |n: usize| -> Vec { + (1..n) + .map(|i| format!("{}*{}", "a".repeat(i), "z".repeat(n - i))) + .collect() + }; + let n = (2..).take_while(|&n| wire(&chain(n)) <= bytes).last().unwrap(); + let texts = chain(n); + let previous = parse(&texts); + (texts, previous) + } + } + } +} + criterion_group!(benches, matching, algebra); criterion_main!(benches); diff --git a/rs/moq-pattern/src/patterns.rs b/rs/moq-pattern/src/patterns.rs index 51524133088..af5bb0bac1a 100644 --- a/rs/moq-pattern/src/patterns.rs +++ b/rs/moq-pattern/src/patterns.rs @@ -13,8 +13,10 @@ use super::{IntersectionError, InvalidPattern, Pattern, index::Index}; /// /// Operations over a whole union (collecting, extending, [`covers`](Self::covers), and /// [`intersect`](Self::intersect)) index one side by segment first, so their cost -/// follows the members a query could match rather than every pair: a peer's large -/// grant costs about its own size, not its square. +/// follows the members a query could match rather than every pair. That keeps common +/// grants near their own size, but containment between wildcard patterns reduces to +/// Orthogonal Vectors, so some shapes stay super-linear (the `pattern-algebra` bench's +/// `mask` and `chain` cases). #[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] pub struct Patterns(Vec); diff --git a/sh/gh/nightly.sh b/sh/gh/nightly.sh index afdc1746b93..839289c8bd8 100755 --- a/sh/gh/nightly.sh +++ b/sh/gh/nightly.sh @@ -177,6 +177,7 @@ case "$1" in javascript jitter just js jitter-bench javascript audio-warmup just js audio-warmup-bench javascript audio-support just js audio-support-bench + javascript pattern just js pattern-bench javascript clock just js clock-bench ;; # The binding benchmark's runners at a token budget, so they keep working at this diff --git a/sh/gh/nightly.test.py b/sh/gh/nightly.test.py index b09e3501714..bd99cb19d2f 100644 --- a/sh/gh/nightly.test.py +++ b/sh/gh/nightly.test.py @@ -208,10 +208,12 @@ def test_every_js_bench_runs_nightly(self): r"^for benchmark in (.+); do\n\s+bun micro\.ts ", (ROOT / "bench/browser/run.sh").read_text(), re.M ) self.assertIsNotNone(smoke) + # Each smoke name runs the entry micro.ts's table names for it. + micro = (ROOT / "bench/browser/micro.ts").read_text() + fixtures = dict(re.findall(r'^\t"?([\w-]+)"?: \{ entry: "([^"]+)"', micro, re.M)) for name in smoke[1].split(): - fixtures = list((ROOT / "js").glob(f"*/bench/{name}.ts")) - self.assertEqual(len(fixtures), 1, f"browser smoke bench {name}") - entries |= set(fixtures) + self.assertIn(name, fixtures, f"browser smoke bench {name}") + entries.add(ROOT / fixtures[name]) # Bundled helpers only run through the entry that names them. helpers = { path for entry in entries for path in entry.parent.glob("*.ts") if f"/{path.name}" in entry.read_text()