@mark1russell7/rigor-bench 0.2.26 → 0.2.28

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
@@ -72,6 +72,9 @@ v.comparison; // the cases that gain and dro
72
72
  | `childLine(stdout)` | From `/fresh`: the last JSON line of a child, with its time `ms`, its `hash` and the reason of a skip. |
73
73
  | `pairOrder(pairs, round, caseIndex)` | From `/fresh`: the order of the pairs of one case in one round, and the first arm of each pair. |
74
74
  | `freshRun(options)` | From `/fresh`: the records of each pair, with each arm in its own fresh child process. |
75
+ | `pairedChild(options)` | The samples of one paired child: the base, the candidate and a copy of the base in one process, in turn. |
76
+ | `pairedChildOrder(round, offset, steps)` | The order of the samples of a paired child: a block A B B A for each pair at each step. |
77
+ | `childRecords(case, round, offset, order, times)` | The `PairedTime` of the candidate pair and of the A/A pair of a paired child, from the medians. |
75
78
  | `codeStamp(options)` | From `/code-stamp`: the stamp of the code of a run, from the code that its entries reach, the lock closure of its engines and its data files. |
76
79
  | `lockClosure(text, importer, names)` | From `/code-stamp`: each package that an engine pulls in, from a pnpm lock file. |
77
80
  | `superviseCases(options)` | From `/supervise`: each case in a child process, held to a time budget, with a hard stop and a resume. |
@@ -446,6 +449,32 @@ A run of many jobs sets `roundOffset` to `job * rounds`. Then the merged records
446
449
 
447
450
  A rotation of N arms turns the order of two arms only when they are N/2 apart in the rotation. For 4 arms, two arms 1 apart come in the order 3:1 over 4 rounds. Thus each pair of `freshRun` has its own two children, and the order of each pair turns each round.
448
451
 
452
+ ## The paired child
453
+
454
+ Two fresh children of a pair start at different times. A slow period of the runner can fall on one child and not on the other. A paired child is one process that loads the three sources of a pair: the base, the candidate and a second copy of the base. It takes their samples in turn, so a slow period falls on each source of a pair.
455
+
456
+ ```ts
457
+ import { pairedChild } from "@mark1russell7/rigor-bench";
458
+
459
+ // The caller loads each source. The copy of the base comes from a second folder, so it has its own module state.
460
+ const child = await pairedChild({
461
+ case: "one-10",
462
+ round,
463
+ offset: caseIndex,
464
+ steps: 4,
465
+ sample: { base: base.burst, candidate: candidate.burst, copy: copy.burst },
466
+ });
467
+ console.log(JSON.stringify(child.records)); // { candidate: PairedTime, aa: PairedTime }
468
+ ```
469
+
470
+ - Each source gives one warm sample first. The child does not count it.
471
+ - Each step has a block A B B A for the candidate pair and for the A/A pair. `firstArm(round, offset)` gives A.
472
+ - The two blocks change places at each step, and the first block turns each round.
473
+ - The record of each pair is one `PairedTime`, with the median of the samples of each source in that pair.
474
+ - The cost is 3 warm samples and 8 counted samples for each step.
475
+
476
+ The A/A pair is the base and its copy in the same child. Its spread is the noise of the order alone, so it gives the band of the candidate pair.
477
+
449
478
  ## A result that changes on purpose
450
479
 
451
480
  A bench compares two arms, and two arms with different results do not do the same work. So a difference stops the merge. A pull request can change a result on purpose. Without a stated path, its author edits the case, and no gate reads that edit. A row in the diff gives that path, and it names the exact change.
package/build/index.d.ts CHANGED
@@ -1468,6 +1468,58 @@ export declare function winClaim(check: MeasureChecks, measure: string, entry: s
1468
1468
  * The function throws a `RangeError` for an empty set, a repeat, a measure with no rule and an entry that the rows do not hold.
1469
1469
  */
1470
1470
  export declare function jointClaim(check: MeasureChecks, measures: readonly string[], entry: string, stratum?: string): JointClaim;
1471
+ /** The sources of a paired child. */
1472
+ export declare const CHILD_SOURCES: readonly ["base", "candidate", "copy"];
1473
+ /** A source of a paired child. */
1474
+ type ChildSource = (typeof CHILD_SOURCES)[number];
1475
+ /** The two pairs of a paired child: the candidate pair and the A/A pair. */
1476
+ type ChildPair = "candidate" | "aa";
1477
+ /** One sample of the order: the pair that it counts for, and the source that gives it. */
1478
+ interface ChildStep {
1479
+ readonly pair: ChildPair;
1480
+ readonly source: ChildSource;
1481
+ }
1482
+ /**
1483
+ * This function gives the order of the samples of one child, for the round and the offset of the case.
1484
+ * - Each step has a block of four samples for each pair, in the order A B B A. `firstArm(round, offset)` gives A.
1485
+ * - The two blocks change places at each step, and the first block turns each round.
1486
+ * - Each source of a pair thus gives two samples in each step, one before and one after the other source.
1487
+ */
1488
+ export declare function pairedChildOrder(round: number, offset: number, steps: number): ChildStep[];
1489
+ /** The two records of one paired child. The time of each arm is the median of its samples in that pair. */
1490
+ interface ChildRecords {
1491
+ readonly candidate: PairedTime;
1492
+ readonly aa: PairedTime;
1493
+ }
1494
+ /** This function gives the sample times of each source of each pair, in the order of the samples. */
1495
+ export declare function childTimes(order: readonly ChildStep[], times: readonly number[]): Record<ChildPair, Record<ChildSource, number[]>>;
1496
+ /** This function gives the records of one paired child from its order and the time of each sample. */
1497
+ export declare function childRecords(caseName: string, round: number, offset: number, order: readonly ChildStep[], times: readonly number[]): ChildRecords;
1498
+ /** The options of one paired child. */
1499
+ interface PairedChildOptions {
1500
+ /** The name of the case. */
1501
+ readonly case: string;
1502
+ /** The global number of the round, a whole number of 0 or more. */
1503
+ readonly round: number;
1504
+ /** The offset of the case for `firstArm`: its index in the list of the cases. */
1505
+ readonly offset: number;
1506
+ /** The count of steps. Each source of each pair gives 2 counted samples in each step. */
1507
+ readonly steps: number;
1508
+ /** The sample function of each source. Each call gives the time of one sample in milliseconds. */
1509
+ readonly sample: Readonly<Record<ChildSource, (tag: string) => Promise<number>>>;
1510
+ }
1511
+ /** The result of one paired child: its order, the time of each sample in that order, and its two records. */
1512
+ interface PairedChild {
1513
+ readonly order: readonly ChildStep[];
1514
+ readonly times: readonly number[];
1515
+ readonly records: ChildRecords;
1516
+ }
1517
+ /**
1518
+ * This function takes the samples of one paired child. Each source first gives one warm sample with the tag `warm`, and
1519
+ * the child does not count it. Then the sources give their samples in the order of `pairedChildOrder`, with the tags
1520
+ * `s0`, `s1` and on. The cost is 3 warm samples and 8 counted samples for each step.
1521
+ */
1522
+ export declare function pairedChild(options: PairedChildOptions): Promise<PairedChild>;
1471
1523
  /** The options of a power test. */
1472
1524
  interface PowerOptions {
1473
1525
  /** The count of the cases of the candidate and of the A/A arm. */
@@ -1595,5 +1647,5 @@ interface Rounds {
1595
1647
  * keeps the work.
1596
1648
  */
1597
1649
  export declare function timeRounds(arms: Readonly<Record<Arm, () => number>>, options: RoundsOptions): Rounds;
1598
- export { type Arm, type ArmModels, type ArmPair, type Balanced, type Band, type BandKind, type BandOptions, type BudgetLook, type BudgetLooksOptions, type BudgetLooksVerdict, type BudgetMore, type BudgetOptions, type BudgetOutcome, type BudgetResult, type BudgetRound, type BudgetVerdict, type CaseBudget, type CaseGate, type CaseInterval, type CaseLimit, type CaseRatio, type CaseResults, type CaseTail, type CaseTailLimit, type Comparison, type ControlFactors, type ControlOptions, type ControlRead, type ControlRow, type EntryCount, type FamilyCase, type FamilyCount, type FamilyItem, type FamilyPower, type FamilyPowerOptions, type FamilyRead, type FamilyShares, type Gate, type GateCaseOutcome, type GateJobRead, type GateOutcome, type GroupCounts, type GroupFactor, type GrowthOptions, type GrowthOutcome, type GrowthRound, type GrowthStep, type GrowthVerdict, type GuardRead, type JobLimitVerdict, type JobRecords, type JobVerdict, type JointClaim, type JointControl, type JointMeasure, type JointVerdict, type Ladder, type LadderDimension, type LadderOptions, type LadderVerdict, type LimitOnModel, type LimitOptions, type LimitOutcome, type LimitVerdict, type MeasureCheck, type MeasureCheckOptions, type MeasureChecks, type MeasureFinding, type MeasureFindingKind, type MeasureRow, type MeasureRule, type MeasuredFactor, type MedianBudget, type ModelLimits, type ModelRead, type ModelRow, type ModelStatus, type ModelTest, type ModelTestOptions, type NoControl, type NoFactor, type NoiseCheck, type NotSlowerOptions, type NotSlowerRead, type NotSlowerVerdict, type OrderSize, type PairedTime, type PartnerRead, type PoolFacts, type PoolOptions, type PooledJob, type PooledLimitVerdict, type PooledRecords, type PooledVerdict, type Power, type PowerOptions, type QuantileBudget, type RateBudget, type ResultRead, type ResultRow, type ResultRows, type ResultVerdict, type Rounds, type RoundsOptions, type RowRead, type RunPairs, type Rung, type RungBudget, type RungEvidence, type RungRecord, type RungVerdict, type SpreadRead, type TailFalseFails, type TailGainCase, type TailLimit, type TailLimitOptions, type TailLimitVerdict, type TailRuleOptions, type TimeOutcome, type TimeVerdict, type VerdictOptions, type VerdictRule, type VisibleShift, type WinClaim, type WorstBudget, armOrder, caseRatios, checkPairedTime, firstArm, orderSize };
1650
+ export { type Arm, type ArmModels, type ArmPair, type Balanced, type Band, type BandKind, type BandOptions, type BudgetLook, type BudgetLooksOptions, type BudgetLooksVerdict, type BudgetMore, type BudgetOptions, type BudgetOutcome, type BudgetResult, type BudgetRound, type BudgetVerdict, type CaseBudget, type CaseGate, type CaseInterval, type CaseLimit, type CaseRatio, type CaseResults, type CaseTail, type CaseTailLimit, type ChildPair, type ChildRecords, type ChildSource, type ChildStep, type Comparison, type ControlFactors, type ControlOptions, type ControlRead, type ControlRow, type EntryCount, type FamilyCase, type FamilyCount, type FamilyItem, type FamilyPower, type FamilyPowerOptions, type FamilyRead, type FamilyShares, type Gate, type GateCaseOutcome, type GateJobRead, type GateOutcome, type GroupCounts, type GroupFactor, type GrowthOptions, type GrowthOutcome, type GrowthRound, type GrowthStep, type GrowthVerdict, type GuardRead, type JobLimitVerdict, type JobRecords, type JobVerdict, type JointClaim, type JointControl, type JointMeasure, type JointVerdict, type Ladder, type LadderDimension, type LadderOptions, type LadderVerdict, type LimitOnModel, type LimitOptions, type LimitOutcome, type LimitVerdict, type MeasureCheck, type MeasureCheckOptions, type MeasureChecks, type MeasureFinding, type MeasureFindingKind, type MeasureRow, type MeasureRule, type MeasuredFactor, type MedianBudget, type ModelLimits, type ModelRead, type ModelRow, type ModelStatus, type ModelTest, type ModelTestOptions, type NoControl, type NoFactor, type NoiseCheck, type NotSlowerOptions, type NotSlowerRead, type NotSlowerVerdict, type OrderSize, type PairedChild, type PairedChildOptions, type PairedTime, type PartnerRead, type PoolFacts, type PoolOptions, type PooledJob, type PooledLimitVerdict, type PooledRecords, type PooledVerdict, type Power, type PowerOptions, type QuantileBudget, type RateBudget, type ResultRead, type ResultRow, type ResultRows, type ResultVerdict, type Rounds, type RoundsOptions, type RowRead, type RunPairs, type Rung, type RungBudget, type RungEvidence, type RungRecord, type RungVerdict, type SpreadRead, type TailFalseFails, type TailGainCase, type TailLimit, type TailLimitOptions, type TailLimitVerdict, type TailRuleOptions, type TimeOutcome, type TimeVerdict, type VerdictOptions, type VerdictRule, type VisibleShift, type WinClaim, type WorstBudget, armOrder, caseRatios, checkPairedTime, firstArm, orderSize };
1599
1651
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["Comparison"],"sources":["../src/budget.ts","../src/growth.ts","../src/verdict.ts","../src/limit.ts","../src/merge.ts","../src/gate.ts","../src/control.ts","../src/ladder.ts","../src/family.ts","../src/model.ts","../src/tail.ts","../src/measures.ts","../src/power.ts","../src/results.ts","../src/rounds.ts"],"mappings":";;;UAQiB;;WAEN;;WAEA;WACA;;;KAIC;;UAGK;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;;WAEA;;WAEA;WACA;;WAEA;;WAEA;;WAEA;WACA;;WAEA;WACA,SAAS;;WAET;;;UAIM;WACN,SAAS;;WAET;WACA;WACA;WACA;WACA,gBAAgB;;;;;;;;;;;;wBAyDX,cAAc,iBAAiB,eAAe,aAAa,eAAe,SAAS,gBAAgB;;UAyBlG;WACN;WACA;;;;;;qBAOE,uBAAuB;;UAOnB;;WAEN;;WAEA;;WAEA,iBAAiB;;WAEjB;;;UAIM;WACN;WACA;;;UAIM,2BAA2B;;WAEjC;;WAEA,eAAe;;WAEf;;;;;;wBAOK,gBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;wBAoDhC,mBAAmB,iBAAiB,eAAe,aAAa,eAAe,SAAS,qBAAqB;;UCrO5G;;WAEN;;WAEA;;WAEA;;;KAIC;;UAGK;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;WACA;;WAEA;;WAEA;WACA;WACA;;WAEA;;WAEA;WACA,SAAS;;;UAIH;;WAEN,SAAS;WACT;WACA;WACA,gBAAgB;;;wBAIX,cAAc,iBAAiB,eAAe,SAAS,gBAAgB;;;;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;WAEA,UAAU;;;UAIJ;WACN;WACA,UAAU,SAAS,OAAO;;;;;;WAM1B;;;;;;wBAOK,aAAa,SAAS,eAAe;;;;;;;;;;;;;UC7BpC;WACN;;WAEA;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;;;UAIM;WACN,eAAe;WACf,eAAe;;;UAIT,mBAAmB;WACzB;;WAEA;;;UAIM;WACN,KAAK;WACL;;;UAIM;;WAEN;;WAEA,gBAAgB;;WAEhB,iBAAiB;;WAEjB,iBAAiB;;WAEjB,gBAAgB;;WAEhB;;;wBAMK,WAAW,mBAAmB;;;;;wBAuC9B,cAAc,kBAAkB,eAAe,MAAM,aAAa;;UCnGjE;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;WACN,SAAS;;WAET;;WAEA;;;;;;;wBAQK,WAAW,MAAM,SAAS,OAAO,qBAAqB,SAAS,gBAAgB"}
1
+ {"version":3,"file":"index.d.ts","names":["Comparison"],"sources":["../src/budget.ts","../src/growth.ts","../src/verdict.ts","../src/limit.ts","../src/merge.ts","../src/gate.ts","../src/control.ts","../src/ladder.ts","../src/family.ts","../src/model.ts","../src/tail.ts","../src/measures.ts","../src/paired-child.ts","../src/power.ts","../src/results.ts","../src/rounds.ts"],"mappings":";;;UAQiB;;WAEN;;WAEA;WACA;;;KAIC;;UAGK;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;;WAEA;;WAEA;WACA;;WAEA;;WAEA;;WAEA;WACA;;WAEA;WACA,SAAS;;WAET;;;UAIM;WACN,SAAS;;WAET;WACA;WACA;WACA;WACA,gBAAgB;;;;;;;;;;;;wBAyDX,cAAc,iBAAiB,eAAe,aAAa,eAAe,SAAS,gBAAgB;;UAyBlG;WACN;WACA;;;;;;qBAOE,uBAAuB;;UAOnB;;WAEN;;WAEA;;WAEA,iBAAiB;;WAEjB;;;UAIM;WACN;WACA;;;UAIM,2BAA2B;;WAEjC;;WAEA,eAAe;;WAEf;;;;;;wBAOK,gBAAgB,gB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;;WAEA;;;;;;;wBAQK,WAAW,MAAM,SAAS,OAAO,qBAAqB,SAAS,gBAAgB"}
package/build/index.js CHANGED
@@ -658,8 +658,22 @@ function checkLadder(ladder) {
658
658
  });
659
659
  return out;
660
660
  }
661
+ /** This function gives the reason that a list has a NaN, with the index of the first one, or undefined. */
662
+ function nanAt(name, values) {
663
+ const index = values.findIndex((value) => Number.isNaN(value));
664
+ return index < 0 ? void 0 : `${name} ${index} is NaN`;
665
+ }
661
666
  /** This function gives the verdict of a rate: the Wilson interval at 95 % against the limit. */
662
667
  function rateResult(budget, failures, trials) {
668
+ const whole = (value) => Number.isSafeInteger(value) && value >= 0;
669
+ if (!(whole(failures) && whole(trials) && failures <= trials)) {
670
+ const why = `the counts are whole numbers of 0 or more with failures not above trials, not ${failures} failures of ${trials} trials`;
671
+ return {
672
+ measure: budget.measure,
673
+ outcome: "cannot decide",
674
+ reason: `The measure ${JSON.stringify(budget.measure)} is "cannot decide": ${why}.`
675
+ };
676
+ }
663
677
  const interval = wilson(failures, trials);
664
678
  const facts = `${failures} failures of ${trials} trials, interval ${interval.low} to ${interval.high}, limit ${budget.limit}`;
665
679
  const outcome = trials === 0 ? "cannot decide" : interval.high <= budget.limit ? "within" : interval.low > budget.limit ? "beyond" : "cannot decide";
@@ -671,6 +685,12 @@ function rateResult(budget, failures, trials) {
671
685
  }
672
686
  /** This function gives the verdict of a set of drills: the largest value against the limit. */
673
687
  function worstResult(budget, values) {
688
+ const nan = nanAt("the drill", values);
689
+ if (nan !== void 0) return {
690
+ measure: budget.measure,
691
+ outcome: "cannot decide",
692
+ reason: `The measure ${JSON.stringify(budget.measure)} is "cannot decide": ${nan}.`
693
+ };
674
694
  const largest = values.length === 0 ? void 0 : Math.max(...values);
675
695
  const facts = `${values.length} drills, the largest ${largest ?? "none"} ${budget.unit}, limit ${budget.limit}`;
676
696
  const outcome = largest !== void 0 && largest > budget.limit ? "beyond" : values.length < budget.minDrills ? "cannot decide" : "within";
@@ -695,7 +715,8 @@ function quantileResult(budget, values, censored) {
695
715
  const open = censored.length > 0;
696
716
  const bounds = [...values, ...censored];
697
717
  if (bounds.length === 0) return say("cannot decide", `0 values, limit ${budget.limit} ${budget.unit}`);
698
- if (values.some((value) => Number.isNaN(value))) return say("cannot decide", "the values have a NaN");
718
+ const nan = nanAt("the value", values);
719
+ if (nan !== void 0) return say("cannot decide", nan);
699
720
  if (!censored.every((value) => Number.isFinite(value))) return say("cannot decide", "a censored value is not a finite number");
700
721
  const lowest = quantileInterval(bounds, budget.quantile, level);
701
722
  const highest = open ? quantileInterval([...values, ...censored.map(() => Infinity)], budget.quantile, level) : lowest;
@@ -2506,6 +2527,107 @@ function jointClaim(check, measures, entry, stratum) {
2506
2527
  measures: measureReads
2507
2528
  };
2508
2529
  }
2530
+ // src/paired-child.ts
2531
+ /**
2532
+ * The paired child of a bench: one process that loads the three sources of a pair and takes their samples in turn.
2533
+ * The sources are the base, the candidate and a second copy of the base. Two fresh children of a pair start at
2534
+ * different times. Thus a slow period of the runner can fall on one child and not on the other. In a paired child, a
2535
+ * slow period falls on each source of a pair.
2536
+ *
2537
+ * The child has two pairs. The candidate pair is the base and the candidate. The A/A pair is the base and its copy,
2538
+ * two copies of one source. Thus the spread of this pair is the noise of the order alone. The caller loads the sources
2539
+ * and gives one sample function for each source. A second copy of the base needs its own module state, so the caller
2540
+ * loads it from a second folder.
2541
+ */
2542
+ /** The sources of a paired child. */
2543
+ const CHILD_SOURCES = [
2544
+ "base",
2545
+ "candidate",
2546
+ "copy"
2547
+ ];
2548
+ /** The second source of each pair: arm `b` of its `PairedTime`. Arm `a` of each pair is the base. */
2549
+ const ARM_B = {
2550
+ candidate: "candidate",
2551
+ aa: "copy"
2552
+ };
2553
+ /**
2554
+ * This function gives the order of the samples of one child, for the round and the offset of the case.
2555
+ * - Each step has a block of four samples for each pair, in the order A B B A. `firstArm(round, offset)` gives A.
2556
+ * - The two blocks change places at each step, and the first block turns each round.
2557
+ * - Each source of a pair thus gives two samples in each step, one before and one after the other source.
2558
+ */
2559
+ function pairedChildOrder(round, offset, steps) {
2560
+ if (!Number.isSafeInteger(steps) || steps < 1) throw new RangeError(`pairedChildOrder: a child needs 1 step or more, not ${steps}.`);
2561
+ const first = firstArm(round, offset);
2562
+ const block = (pair) => {
2563
+ const [x, y] = first === "a" ? ["base", ARM_B[pair]] : [ARM_B[pair], "base"];
2564
+ return [
2565
+ x,
2566
+ y,
2567
+ y,
2568
+ x
2569
+ ].map((source) => ({
2570
+ pair,
2571
+ source
2572
+ }));
2573
+ };
2574
+ const order = [];
2575
+ for (let step = 0; step < steps; step++) {
2576
+ const candidateFirst = (step + round) % 2 === 0;
2577
+ order.push(...candidateFirst ? [...block("candidate"), ...block("aa")] : [...block("aa"), ...block("candidate")]);
2578
+ }
2579
+ return order;
2580
+ }
2581
+ /** This function gives the sample times of each source of each pair, in the order of the samples. */
2582
+ function childTimes(order, times) {
2583
+ if (order.length !== times.length) throw new RangeError(`childTimes: ${times.length} times for ${order.length} samples.`);
2584
+ const out = {
2585
+ candidate: {
2586
+ base: [],
2587
+ candidate: [],
2588
+ copy: []
2589
+ },
2590
+ aa: {
2591
+ base: [],
2592
+ candidate: [],
2593
+ copy: []
2594
+ }
2595
+ };
2596
+ order.forEach((step, index) => out[step.pair][step.source].push(times[index]));
2597
+ return out;
2598
+ }
2599
+ /** This function gives the records of one paired child from its order and the time of each sample. */
2600
+ function childRecords(caseName, round, offset, order, times) {
2601
+ const first = firstArm(round, offset);
2602
+ const bySource = childTimes(order, times);
2603
+ const record = (pair) => ({
2604
+ case: caseName,
2605
+ round,
2606
+ first,
2607
+ a: median(bySource[pair].base),
2608
+ b: median(bySource[pair][ARM_B[pair]])
2609
+ });
2610
+ return {
2611
+ candidate: record("candidate"),
2612
+ aa: record("aa")
2613
+ };
2614
+ }
2615
+ /**
2616
+ * This function takes the samples of one paired child. Each source first gives one warm sample with the tag `warm`, and
2617
+ * the child does not count it. Then the sources give their samples in the order of `pairedChildOrder`, with the tags
2618
+ * `s0`, `s1` and on. The cost is 3 warm samples and 8 counted samples for each step.
2619
+ */
2620
+ async function pairedChild(options) {
2621
+ const order = pairedChildOrder(options.round, options.offset, options.steps);
2622
+ for (const source of CHILD_SOURCES) await options.sample[source]("warm");
2623
+ const times = [];
2624
+ for (const [index, { source }] of order.entries()) times.push(await options.sample[source](`s${index}`));
2625
+ return {
2626
+ order,
2627
+ times,
2628
+ records: childRecords(options.case, options.round, options.offset, order, times)
2629
+ };
2630
+ }
2509
2631
  // src/power.ts
2510
2632
  /**
2511
2633
  * The power test of a time verdict. It draws seeded benches with a known speedup and counts the verdicts that find it.
@@ -2724,6 +2846,6 @@ function timeRounds(arms, options) {
2724
2846
  sink
2725
2847
  };
2726
2848
  }
2727
- export { BUDGET_LOOKS, CEILING_ONLY, GATE_LOOKS, LADDER_FORMAT, NARROW_SPREAD_SHARE, UNKNOWN_MODEL, aaBand, aaSpread, armModels, armOrder, armVerdicts, balanceOrders, budgetLookSpend, budgetLooksVerdict, budgetVerdict, caseIntervals, caseRatios, caseTails, checkLadder, checkMeasures, checkPairedTime, controlFactor, familyPower, familyRead, firstArm, gateOf, growthVerdict, jointClaim, ladderVerdict, limitOnModel, limitVerdict, modelRowText, modelTest, notSlowerVerdict, orderSize, poolRecords, pooledBand, pooledLimitVerdict, pooledVerdict, resultRows, resultVerdict, rungVerdict, tailFalseFails, tailLimitVerdict, timeRounds, timeVerdict, verdictMargin, verdictPower, visibleShift, winClaim };
2849
+ export { BUDGET_LOOKS, CEILING_ONLY, CHILD_SOURCES, GATE_LOOKS, LADDER_FORMAT, NARROW_SPREAD_SHARE, UNKNOWN_MODEL, aaBand, aaSpread, armModels, armOrder, armVerdicts, balanceOrders, budgetLookSpend, budgetLooksVerdict, budgetVerdict, caseIntervals, caseRatios, caseTails, checkLadder, checkMeasures, checkPairedTime, childRecords, childTimes, controlFactor, familyPower, familyRead, firstArm, gateOf, growthVerdict, jointClaim, ladderVerdict, limitOnModel, limitVerdict, modelRowText, modelTest, notSlowerVerdict, orderSize, pairedChild, pairedChildOrder, poolRecords, pooledBand, pooledLimitVerdict, pooledVerdict, resultRows, resultVerdict, rungVerdict, tailFalseFails, tailLimitVerdict, timeRounds, timeVerdict, verdictMargin, verdictPower, visibleShift, winClaim };
2728
2850
 
2729
2851
  //# sourceMappingURL=index.js.map