site_results.ts

Which results file the site renders, and whether it may. The site shows one validated file: the latest published timed run when one is committed, and otherwise the deterministic results, which hold no timed number. The fixture run, whose numbers are invented, is used only when a build asks for it.

view source

Declarations
#

8 declarations

bench_results_are_timed
#

site_results.ts view source

(results: { meta: { generated_at: string | null; machine: { name: string; cpu: string; threads: number | null; governor: string | null; cpufreq_driver: string | null; epp: string | null; boost: boolean | null; memory_gb: number; os_release: string; } | null; ... 10 more ...; bundler: { ...; } | ... 1 more ... | null; }; ... 8 more ...; coverage: Record<...>; }): boolean import {bench_results_are_timed} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

Whether a results file holds any timed number.

results

returns

boolean

find_first_difference
#

site_results.ts view source

(a: unknown, b: unknown, path?: string): string | null import {find_first_difference} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

The path of the first place two JSON values differ, or null when they are equal. Object keys are compared as sets, so their order doesn't matter.

a

type unknown

b

type unknown

path

type string
default ''

returns

string | null

find_moved_since
#

site_results.ts view source

(run: { meta: { generated_at: string | null; machine: { name: string; cpu: string; threads: number | null; governor: string | null; cpufreq_driver: string | null; epp: string | null; boost: boolean | null; memory_gb: number; os_release: string; } | null; ... 10 more ...; bundler: { ...; } | ... 1 more ... | null; }; ... 8 more ...; coverage: Record<...>; }, deterministic: { ...; }): string[] import {find_moved_since} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

What differs between a published run and the deterministic results in the things a deterministic number depends on: each library's version with its extra packages, the versions of its dependencies (its install closure), the corpus, and what built and compressed the bundles (BenchBundler), when both files hold bundle sizes.

run

deterministic

returns

string[]

a phrase for each thing that moved, none when the run describes the same libraries, corpus, and bundler as the deterministic results

HEAP_MOVED
#

site_results.ts view source

"the retained heaps, which move with the Node version they are read on" import {HEAP_MOVED} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

What moved says when the retained heaps differ beyond a reading's jitter.

resolve_site_results
#

site_results.ts view source

(files: SiteResultsFiles): SiteResults import {resolve_site_results} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

Chooses and validates the results the site renders. Every file given is parsed through parse_bench_results, so no number reaches a page unchecked.

  • With a fixture, the fixture, as fixture: the build asked for it.
  • Otherwise with a latest run, that run, as published. It must pass bench_results_is_publishable, with no exception: a run whose anchor drifted is refused like a smoke run.
  • Otherwise the deterministic results, as deterministic.

A published run is checked against the deterministic results. When both describe the same library versions and corpus, their deterministic numbers (sets, coverage, bundle sizes, install footprints, and each cell's token counts and output sizes, raw and compressed) must be equal. When a version or the corpus has moved since the run, the run is rendered as the snapshot it is, and moved says what moved. When nothing has and the exact numbers agree, retained heaps beyond a reading's jitter (bench_heaps_agree) also make the run a snapshot, as HEAP_MOVED: they move with the Node version, which nothing else records.

files

returns

SiteResults

throws

  • Error - if a file doesn't parse, if the latest run is not publishable, if it disagrees with the deterministic results it should equal, or if the deterministic file holds a timed number

SiteResults
#

site_results.ts view source

SiteResults import type {SiteResults} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

The results the site renders, and where they came from.

source

type SiteResultsSource

results

type BenchResults

moved

What has changed since a published run was measured, one phrase for each thing: a library now at another version, or the corpus. Empty when the run describes the tree as it is, and for any other source.

type string[]

corpus_current

Whether the inputs of these results are the repository's corpus as it is committed: true for the deterministic results and for a published run of the same corpus, and false for a run of an earlier corpus and for the fixture.

type boolean

SiteResultsFiles
#

site_results.ts view source

SiteResultsFiles import type {SiteResultsFiles} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

The parsed JSON of each results file the site may render, null for one that is absent.

deterministic

The deterministic results, which are always committed.

type unknown

latest

The latest published timed run, or null when none is committed.

type unknown

fixture

The fixture run, given only when the build asked for it, and null otherwise.

type unknown

SiteResultsSource
#

site_results.ts view source

SiteResultsSource

type "deterministic" | "published" | "fixture"

import type {SiteResultsSource} from '@ryanatkn/syntax-highlighter-bench/site_results.js';

Where the results a page shows came from:

  • deterministic - the committed deterministic results, with nothing timed
  • published - the latest published timed run
  • fixture - the test fixture, whose numbers are invented

Depends on
#

Imported by
#