results_schema.ts

The results file: one run of the benchmark, written by the harness and parsed by the site. Both sides import these schemas, so a malformed run fails the harness and the build rather than rendering blanks.

The file separates two classes of number. Machine-dependent numbers come from the timed harness on a named machine: each cell's values and the startup section (cold start). Deterministic numbers regenerate identically anywhere: each cell's tokens, output, and compressed, plus bundle, install, and coverage. A file may hold only the deterministic ones: it then records no machine, time, or commit, since none of them shaped its numbers.

A library missing from a cell is in one of two states, and the file keeps them apart. Unsupported means the library doesn't claim the language — it has no entry for it in coverage. Excluded means it claims the language but failed the pre-measurement output check — it has an entry in meta.excluded. Neither is ever a zero.

The file is self-describing: meta.libraries, langs, sets, and inputs are rosters, and every other section refers to them by id, or by file for inputs. The language ids are owned by the harness in bench/langs.ts, not enumerated here, so a new id needs no schema change and the site reads the roster from the file.

view source

Declarations
#

57 declarations

BENCH_ANCHOR_STABLE_BELOW
#

results_schema.ts view source

0.03 import {BENCH_ANCHOR_STABLE_BELOW} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The anchor drift under which a run counts as stable; 0.03 is 3%. Past it the machine changed state during the run, and the ratios between libraries in a cell are more trustworthy than any absolute time.

bench_heap_agrees
#

results_schema.ts view source

(a: { retained_kb: number; code_kb: number; external_kb: number; }, b: { retained_kb: number; code_kb: number; external_kb: number; }): boolean import {bench_heap_agrees} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Whether two heap entries are the same reading, each number within heap_readings_agree.

a

b

returns

boolean

bench_heaps_agree
#

results_schema.ts view source

(a: Record<string, Record<string, { retained_kb: number; code_kb: number; external_kb: number; }>>, b: Record<string, Record<string, { retained_kb: number; code_kb: number; external_kb: number; }>>): boolean import {bench_heaps_agree} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Whether two heap sections hold the same readings, each within heap_readings_agree.

a

type Record<string, Record<string, BenchHeap>>

b

type Record<string, Record<string, BenchHeap>>

returns

boolean

bench_results_find_gaps
#

results_schema.ts view source

(results: BenchResultsCoverage, numbers?: "values" | "deterministic"): BenchResultsGap[] import {bench_results_find_gaps} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Lists what a results file lacks to be a complete run, from the file alone:

  • in every cell, every library of the roster that claims the cell's language has a number or an entry in meta.excluded. The number is a timed value, or for a deterministic-only file the one the cell states: its token count on a tokenize cell, its output size on an html cell
  • every listed input of a timed language that some library claims has a cell in every mode the file's cells use

It can't tell that an input is missing altogether, or a whole mode: the inputs roster lists what was measured, only meta.corpus_hash names the corpus it came from, and the modes are taken from the cells so that a file stays valid when the harness gains a mode.

results

the file, or the parts of it that say

numbers

which numbers the file should be complete in: its timed values, or the deterministic number each cell states

type "values" | "deterministic"
default 'values'

returns

BenchResultsGap[]

the gaps, none for a file that covers everything it lists

bench_results_find_startup_gaps
#

results_schema.ts view source

(results: BenchResultsStartupCoverage): BenchResultsGap[] import {bench_results_find_startup_gaps} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Lists the cold-start scenarios a results file lacks to be a complete run, from the file alone. Each of these has an entry in startup or in meta.startup_excluded:

  • the bare baseline
  • for every library of the roster, unbundled and bundled: core, then lang and first_highlight for every timed language it claims, then set for every feature set the file's cold start names, where the library claims every language of it

A scenario over a language or a set the library doesn't claim is unsupported, and is no gap. The sets are taken from the file, since the schema doesn't say which sets a harness starts cold. So one thing the file can't show: with every set entry removed it names no set, and still reads as complete.

results

the file, or the parts of it that say

returns

BenchResultsGap[]

the gaps, none for a file whose cold start is whole

bench_results_is_publishable
#

results_schema.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_is_publishable} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Whether a run's numbers can be published as results: a complete full run with no gap in its cells or its cold start (bench_results_find_gaps, bench_results_find_startup_gaps), from a commit that records everything that ran, on a machine that held still and was calibrated, so the run carries a noise floor that says which differences are results. A run that was stopped and resumed qualifies like any other: its anchor covers every segment. A site shows anything else as what it is, never as a result.

results

returns

boolean

bench_run_is_complete
#

results_schema.ts view source

(run: Pick<{ kind: "full" | "smoke" | "calibrate"; passes: number; rounds: number; target_ms: number; warmup_ms: number; rewarm_ms: number; retries: number; loaded_langs: "cell"; collection: "minor"; ... 6 more ...; load_at_start: number; }, "kind" | "filters">): boolean import {bench_run_is_complete} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Whether a run set out to cover everything: every library on every cell, and for a full run in every cold-start scenario, measured for real. A smoke run never did, and neither did a run with any filter. Whether the file then holds everything is bench_results_find_gaps and bench_results_find_startup_gaps.

run

type Pick<BenchRun, "kind" | "filters">

returns

boolean

BenchAnchor
#

results_schema.ts view source

value + type

{ drift: number; stable: boolean; } import {BenchAnchor} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The reference workload measured at the start and end of a run, and of every segment of a run that was stopped and resumed. Its drift says whether the machine changed state while the run was in progress.

drift

type number

stable

type boolean

BenchBundleEntry
#

results_schema.ts view source

value + type

{ wasm: { raw: number; gzip: number; brotli: number; } | null; css: { raw: number; gzip: number; brotli: number; } | null; raw: number; gzip: number; brotli: number; } | { unsupported: string[]; }

type BenchBundleSizes | BenchBundleUnsupported

import {BenchBundleEntry} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One library's result for one feature set: its sizes, or why there are none. An entry with an unsupported key is read as the latter and anything else as sizes, so a malformed entry is reported against the shape it was meant to be.

BenchBundler
#

results_schema.ts view source

value + type

{ esbuild: string; gzip_level: number; brotli_quality: number; vite: string; rolldown: string; } | { esbuild: string; gzip_level: number; brotli_quality: number; vite: string; rollup: string; }

type BenchBundlerRolldown | BenchBundlerRollup

import {BenchBundler} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What the bundle sizes were built and compressed with. Together with the libraries' versions it is what the sizes depend on, apart from the zlib and brotli inside the Node that compressed them. The compression levels are also the ones the HTML's compressed sizes (BenchCell.compressed) are taken at. It names exactly one of rolldown and rollup, and is reported against the shape it names, so a malformed one never reads as a bare "Invalid input".

BenchBundlerRolldown
#

results_schema.ts view source

value + type

{ esbuild: string; gzip_level: number; brotli_quality: number; vite: string; rolldown: string; } import {BenchBundlerRolldown} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What bundles from Vite 8 on: Vite with the Rolldown inside it.

esbuild

type string

gzip_level

type number

brotli_quality

type number

vite

type string

rolldown

type string

BenchBundlerRollup
#

results_schema.ts view source

value + type

{ esbuild: string; gzip_level: number; brotli_quality: number; vite: string; rollup: string; } import {BenchBundlerRollup} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What bundled up to Vite 7, which files measured then record: Vite with the Rollup inside it.

esbuild

type string

gzip_level

type number

brotli_quality

type number

vite

type string

rollup

type string

BenchBundleSizes
#

results_schema.ts view source

value + type

{ wasm: { raw: number; gzip: number; brotli: number; } | null; css: { raw: number; gzip: number; brotli: number; } | null; raw: number; gzip: number; brotli: number; } import {BenchBundleSizes} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The bundled size of one library over one feature set: raw, gzip, and brotli are the minified JS, and what else a page loads for the library has a section of its own. Deterministic.

wasm

type BenchByteSizes | null

css

type BenchByteSizes | null

raw

type number

gzip

type number

brotli

type number

BenchBundleUnsupported
#

results_schema.ts view source

value + type

{ unsupported: string[]; } import {BenchBundleUnsupported} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

A feature set a library can't be measured over, naming the languages it lacks.

unsupported

type string[]

BenchByteSizes
#

results_schema.ts view source

value + type

{ raw: number; gzip: number; brotli: number; } import {BenchByteSizes} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Some bytes a page loads, measured raw and compressed. Deterministic.

raw

type number

gzip

type number

brotli

type number

BenchCell
#

results_schema.ts view source

value + type

{ id: string; metric: "throughput"; lang: string; size: "micro" | "small" | "medium" | "large"; mode: "tokenize" | "html"; source: "neutral" | "shiki" | "home" | "harness" | "stress"; ... 8 more ...; compressed: Record<...>; } import {BenchCell} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One input measured in one mode, across libraries. A library absent from values, tokens, and output was not measured here: it is unsupported, excluded, or outside the run's filters.

Each deterministic number is stated once for an input, on the cell whose call returns it: tokens on the tokenize cell, since it counts what tokenize returned, and output on the html cell. The other is empty there.

id

type string

metric

type "throughput"

lang

type string

size

type "micro" | "small" | "medium" | "large"

mode

type "tokenize" | "html"

source

type "neutral" | "shiki" | "home" | "harness" | "stress"

home

type string | null

file

type string

bytes

type number

lines

type number

synthetic

type boolean

values

type Record<string, BenchCellValue>

tokens

type Record<string, number>

output

type Record<string, BenchCellOutput>

compressed

type Record<string, BenchCellCompressed>

BenchCellCompressed
#

results_schema.ts view source

value + type

{ gzip: number; brotli: number; } import {BenchCellCompressed} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The size of one library's HTML for a cell's input once compressed, at the levels BenchBundler records: what a server sends for a page that renders the highlighted input. Its raw size is BenchCellOutput.html_bytes. Deterministic.

gzip

type number

brotli

type number

BenchCellOutput
#

results_schema.ts view source

value + type

{ html_bytes: number; spans: number; } import {BenchCellOutput} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The size of one library's HTML for a cell's input. Deterministic.

html_bytes

type number

spans

type number

BenchCellValue
#

results_schema.ts view source

value + type

{ ns_per_op: number; ops_per_sec: number; mb_per_sec: number; p10_ns: number; p90_ns: number; spread: number; pass_medians_ns: number[]; iterations: number; rss_peak_bytes: number; attempts: number; } import {BenchCellValue} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One library's timing and memory in one cell. Machine-dependent.

ns_per_op

type number

ops_per_sec

type number

mb_per_sec

type number

p10_ns

type number

p90_ns

type number

spread

type number

pass_medians_ns

type number[]

iterations

type number

rss_peak_bytes

type number

attempts

type number

BenchColorScheme
#

results_schema.ts view source

value + type

"light" | "dark"

type "light" | "dark"

import {BenchColorScheme} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

A color scheme a theme covers.

BenchCoverageEntry
#

results_schema.ts view source

value + type

true | { via: string; }

type true | { via: string; }

import {BenchCoverageEntry} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

How a library supports a language it claims: true for directly, or a footnote for anything a reader should know, like a third-party grammar.

BenchEngineKind
#

results_schema.ts view source

value + type

"scanner" | "grammar_vm" | "regex" | "textmate"

type "scanner" | "grammar_vm" | "regex" | "textmate"

import {BenchEngineKind} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

How a library lexes. A filterable tag, not a ranking.

BenchExcluded
#

results_schema.ts view source

value + type

{ cell: string; library: string; reason: string; } import {BenchExcluded} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

A library that claims a cell's language but failed the pre-measurement output check there, so it was not measured. Distinct from unsupported, which is a language missing from the library's coverage.

cell

type string

library

type string

reason

type string

BenchHeap
#

results_schema.ts view source

value + type

{ retained_kb: number; code_kb: number; external_kb: number; } import {BenchHeap} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What a library holds once one language is loaded and highlighted once, over a bare Node process: its single:<lang> bundle imported, the language's harness snippet highlighted, and garbage collected until the heap settles. That is after one highlight of a small snippet; larger inputs leave more, most of all for regexp and wasm engines. Deterministic for a Node version and platform (the one the check workflow pins, on x64), within heap_readings_agree.

retained_kb

type number

code_kb

type number

external_kb

type number

BenchInput
#

results_schema.ts view source

value + type

{ file: string; source: "neutral" | "shiki" | "home" | "harness" | "stress"; home: string | null; lang: string; size: "micro" | "small" | "medium" | "large"; bytes: number; lines: number; sha256: string; synthetic: boolean; provenance: { ...; }[]; derivation: string | null; } import {BenchInput} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One input of the corpus: a file, what it is, and where it came from. The corpus manifest is a list of these, and a results file carries the ones its cells measured.

file

type string

source

type "neutral" | "shiki" | "home" | "harness" | "stress"

home

type string | null

lang

type string

size

type "micro" | "small" | "medium" | "large"

bytes

type number

lines

type number

sha256

type string

synthetic

type boolean

provenance

type BenchProvenance[]

derivation

type string | null

BenchInstall
#

results_schema.ts view source

value + type

{ packages: number; files: number; bytes: number; closure: string; } import {BenchInstall} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What npm install of a library adds: the runtime dependency closure of its package and its extra packages, each package counted once, as this repository's lockfile installs them. Deterministic.

packages

type number

files

type number

bytes

type number

closure

type string

BenchLang
#

results_schema.ts view source

value + type

{ id: string; label: string; timed: boolean; } import {BenchLang} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One language id of the run, as the harness declares it in bench/langs.ts.

id

type string

label

type string

timed

type boolean

BenchLibrary
#

results_schema.ts view source

value + type

{ id: string; label: string; package: string; version: string; output: "classes" | "inline_styles"; engine: "scanner" | "grammar_vm" | "regex" | "textmate"; by_maintainer: boolean; note: string | null; theme_schemes: ("light" | "dark")[]; extra_packages?: Record<...> | undefined; } import {BenchLibrary} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One measured library. The roster of these drives every page of the site.

id

type string

label

type string

package

type string

version

type string

output

type "classes" | "inline_styles"

engine

type "scanner" | "grammar_vm" | "regex" | "textmate"

by_maintainer

type boolean

note

type string | null

theme_schemes

type ("light" | "dark")[]

extra_packages?

type Record<string, string>

BenchMachine
#

results_schema.ts view source

value + type

{ 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; } import {BenchMachine} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The machine a run's timed numbers came from.

name

type string

cpu

type string

threads

type number | null

governor

type string | null

cpufreq_driver

type string | null

epp

type string | null

boost

type boolean | null

memory_gb

type number

os_release

type string

BenchMeta
#

results_schema.ts view source

value + type

{ 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; } import {BenchMeta} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Where, when, and from what a run was produced. generated_at, machine, node, and commit say where timed numbers came from, and are null only in a file that has none: its numbers are the same on any machine, at any time, and a commit can't name the tree it is itself committed in.

generated_at

type string | null

machine

type BenchMachine | null

node

type string | null

commit

type string | null

corpus_hash

type string

run

type BenchRun | null

anchor

type BenchAnchor | null

libraries

type BenchLibrary[]

excluded

type BenchExcluded[]

startup_excluded

type BenchStartupExcluded[]

noise_floor

type BenchNoiseFloor | null

process_noise

type BenchProcessNoise | null

bundler

type BenchBundlerRolldown | BenchBundlerRollup | null

BenchMetric
#

results_schema.ts view source

value + type

"throughput" import {BenchMetric} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What a cell measures.

BenchMode
#

results_schema.ts view source

value + type

"tokenize" | "html"

type "tokenize" | "html"

import {BenchMode} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The stage a cell runs: tokens out, or the HTML string consumers ship.

BenchNoiseFloor
#

results_schema.ts view source

value + type

{ per_cell: number; geomean: number; per_process: number | null; } import {BenchNoiseFloor} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The machine's noise floor, from a calibration run: every library is measured as two, in separate processes, which should come out equal. A difference smaller than this is not a result.

per_cell

type number

geomean

type number

per_process

type number | null

BenchOutputKind
#

results_schema.ts view source

value + type

"classes" | "inline_styles"

type "classes" | "inline_styles"

import {BenchOutputKind} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What a library's html output carries its colors in.

BenchProcessNoise
#

results_schema.ts view source

value + type

{ pairs: number; median: number; p95: number; max: number; } import {BenchProcessNoise} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

How far apart a run's own processes came out: an A/A figure from the run itself. Each library on each cell was measured by several processes, which should agree, and every pair of them gives a deviation. It is fuz_util's StatsPairwiseDeviation, restated here so the schema depends on zod alone.

pairs

type number

median

type number

p95

type number

max

type number

BenchProvenance
#

results_schema.ts view source

value + type

{ repo: string; commit: string; path: string; sha256: string; license: string; note: string | null; } import {BenchProvenance} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One file an input came from, pinned so the input can be rebuilt and checked.

repo

type string

commit

type string

path

type string

sha256

type string

license

type string

note

type string | null

BenchResults
#

results_schema.ts view source

value + type

{ 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... import {BenchResults} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One run of the benchmark. Beyond each section's shape, parsing checks that the sections agree: ids are unique and refer to roster entries, every cell describes its input as the inputs roster does and is named after it, no library has numbers for a language it doesn't claim or a cell it was excluded from, no cell covers an untimed language, a run with timed numbers has an anchor, its run parameters, and where it came from, a run with no filters has no gap (bench_results_find_gaps, and for a full run bench_results_find_startup_gaps), each deterministic number of an input is stated on one cell, and bundle sizes cover every library and set or none, as the install footprints cover every library and the compressed HTML sizes every library with an HTML size.

meta

type BenchMeta

langs

type BenchLang[]

sets

type BenchSet[]

inputs

type BenchInput[]

cells

type BenchCell[]

startup

type BenchStartup[]

bundle

type Record<string, Record<string, BenchBundleEntry>>

install

type Record<string, BenchInstall>

heap

type Record<string, Record<string, BenchHeap>>

coverage

type Record<string, Record<string, BenchCoverageEntry>>

BenchResultsCoverage
#

results_schema.ts view source

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

The parts of a results file that say whether it has a gap.

meta

type { libraries: { id: string; }[]; excluded: { cell: string; library: string; reason: string; }[]; }

langs

type BenchLang[]

inputs

type { file: string; lang: string; }[]

cells

type Pick<BenchCell, "id" | "output" | "lang" | "values" | "mode" | "tokens">[]

coverage

type Record<string, Record<string, unknown>>

BenchResultsGap
#

results_schema.ts view source

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

Something a results file lacks that a complete run would have, and where.

path

type (string | number)[]

message

type string

BenchResultsStartupCoverage
#

results_schema.ts view source

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

The parts of a results file that say whether its cold start has a gap.

meta

type { libraries: { id: string; }[]; startup_excluded: BenchStartupKey[]; }

langs

type BenchLang[]

sets

type { id: string; langs: string[]; }[]

startup

type BenchStartupKey[]

coverage

type Record<string, Record<string, unknown>>

BenchRun
#

results_schema.ts view source

value + type

{ kind: "full" | "smoke" | "calibrate"; passes: number; rounds: number; target_ms: number; warmup_ms: number; rewarm_ms: number; retries: number; loaded_langs: "cell"; collection: "minor"; startup_samples: number | null; ... 5 more ...; load_at_start: number; } import {BenchRun} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

How the timed numbers of a run were measured: its cells and its cold-start scenarios. It tells a complete full run from a smoke, calibration, or partial run: see bench_results_is_publishable.

kind

type "full" | "smoke" | "calibrate"

passes

type number

rounds

type number

target_ms

type number

warmup_ms

type number

rewarm_ms

type number

retries

type number

loaded_langs

type "cell"

collection

type "minor"

startup_samples

type number | null

startup_discard

type number | null

startup_compile_cache

type "disabled" | null

filters

type BenchRunFilters

segments

type number

duration_ms

type number

load_at_start

type number

BenchRunFilters
#

results_schema.ts view source

value + type

{ libraries: string[] | null; langs: string[] | null; sizes: ("micro" | "small" | "medium" | "large")[] | null; modes: ("tokenize" | "html")[] | null; sources: ("neutral" | "shiki" | "home" | "harness" | "stress")[] | null; metrics: ("throughput" | "startup")[] | null; } import {BenchRunFilters} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The filters a run was restricted by. Each is null when the run was not restricted on that axis. libraries and langs narrow the cells and the cold-start scenarios alike; sizes, modes, and sources select inputs, so they narrow the cells only.

libraries

type string[] | null

langs

type string[] | null

sizes

type ("micro" | "small" | "medium" | "large")[] | null

modes

type ("tokenize" | "html")[] | null

sources

type ("neutral" | "shiki" | "home" | "harness" | "stress")[] | null

metrics

type ("throughput" | "startup")[] | null

BenchRunKind
#

results_schema.ts view source

value + type

"full" | "smoke" | "calibrate"

type "full" | "smoke" | "calibrate"

import {BenchRunKind} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What a run is: full measures with the published parameters, smoke runs every cell once to prove the harness works and its numbers mean nothing, and calibrate measures every library twice in every cell to find the noise floor.

BenchRunMetric
#

results_schema.ts view source

value + type

"throughput" | "startup"

type "throughput" | "startup"

import {BenchRunMetric} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

A machine-dependent measurement a run makes: throughput is the timed cells, and startup is cold start.

BenchSet
#

results_schema.ts view source

value + type

{ id: string; label: string; langs: string[]; footnote: string | null; } import {BenchSet} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

A named list of languages that bundle size is measured over.

id

type string

label

type string

langs

type string[]

footnote

type string | null

BenchSize
#

results_schema.ts view source

value + type

"micro" | "small" | "medium" | "large"

type "micro" | "small" | "medium" | "large"

import {BenchSize} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

An input's size tier, by real file size.

BenchSource
#

results_schema.ts view source

value + type

"neutral" | "shiki" | "home" | "harness" | "stress"

type "neutral" | "shiki" | "home" | "harness" | "stress"

import {BenchSource} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Who an input came from: neutral is real code no measured library authored, shiki is Shiki's upstream benchmark samples, home is one library's own samples, and harness is a snippet written for this benchmark.

BenchStartup
#

results_schema.ts view source

value + type

{ samples: number; median_ms: number; p10_ms: number; p90_ms: number; spread: number; rss_peak_bytes: number; scenario: "set" | "bare" | "core" | "lang" | "first_highlight"; library: string | null; lang: string | null; set: string | null; bundled: boolean; } import {BenchStartup} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

One cold-start measurement. Each sample is a fresh Node process that does the scenario's work and nothing else, and its time is the process's own clock when the work is done, which counts from the start of the process. So every time includes Node starting up, and the bare entry is that part alone. Machine-dependent.

samples

type number

median_ms

type number

p10_ms

type number

p90_ms

type number

spread

type number

rss_peak_bytes

type number

scenario

type "set" | "bare" | "core" | "lang" | "first_highlight"

library

type string | null

lang

type string | null

set

type string | null

bundled

type boolean

BenchStartupExcluded
#

results_schema.ts view source

value + type

{ library: string; reason: string; scenario: "set" | "bare" | "core" | "lang" | "first_highlight"; lang: string | null; set: string | null; bundled: boolean; } import {BenchStartupExcluded} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

A cold-start scenario a library was not sampled in: its first process there failed to import, exported nothing, or highlighted with too few kinds of span. Distinct from unsupported, which is a scenario whose languages the library doesn't claim, and which has no entry anywhere.

library

type string

reason

type string

scenario

type "set" | "bare" | "core" | "lang" | "first_highlight"

lang

type string | null

set

type string | null

bundled

type boolean

BenchStartupKey
#

results_schema.ts view source

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

What tells one cold-start scenario from another.

set

type string | null

library

type string | null

lang

type string | null

scenario

type "set" | "bare" | "core" | "lang" | "first_highlight"

bundled

type boolean

BenchStartupScenario
#

results_schema.ts view source

value + type

"set" | "bare" | "core" | "lang" | "first_highlight"

type "set" | "bare" | "core" | "lang" | "first_highlight"

import {BenchStartupScenario} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

What a cold-start sample does before it stops the clock: bare is Node alone, core imports a library with no language, lang imports it with one language, set imports it with a feature set's languages, and first_highlight imports it with one language and highlights once.

describe_bench_run
#

results_schema.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<...>; }): string import {describe_bench_run} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The facts of a run that decide whether it is publishable, as one line for an error.

results

returns

string

heap_readings_agree
#

results_schema.ts view source

(a: number, b: number): boolean import {heap_readings_agree} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Whether two heap readings, in KiB, are the same reading: within HEAP_TOLERANCE_KB, or HEAP_TOLERANCE_RATIO of the larger, whichever is larger.

a

type number

b

type number

returns

boolean

parse_bench_results
#

results_schema.ts view source

(data: unknown): { 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<...>; } import {parse_bench_results} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

Parses a results file, with every problem in one readable message.

data

the parsed JSON of a results file

type unknown

returns

BenchResults

the validated results

throws

  • if - the data doesn't match `BenchResults`

to_bench_cell_id
#

results_schema.ts view source

(file: string, mode: "tokenize" | "html"): string import {to_bench_cell_id} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The id of a cell: its input's file and its mode, which together are unique in a run.

file

type string

mode

returns

string

to_bench_startup_key
#

results_schema.ts view source

(entry: BenchStartupKey): string import {to_bench_startup_key} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The string a cold-start scenario is told apart by.

entry

returns

string

to_max_compressed_bytes
#

results_schema.ts view source

(raw: number): number import {to_max_compressed_bytes} from '@ryanatkn/syntax-highlighter-bench/results_schema.js';

The most a compressed size may exceed the raw one by: a compression format adds a header and a little framing, so a few bytes of input, or bytes that don't compress, come out slightly larger. Anything past that is a mistake.

raw

type number

returns

number

Depends on
#

Imported by
#