bundle_matrix.ts

The bundle-size tables. A results file measures each library over feature sets: one with no language, one for each language alone, and a few of several languages. What a language adds to a library is derived here, as its single-language set less the set with none, and is never stored, so it can't drift from the measured sets.

The sets are found by what they hold, not by their ids: the core set is the one with no language, and a language's own set is the one holding it alone.

view source

Declarations
#

22 declarations

BUNDLE_COMPRESSIONS
#

BUNDLE_VIEWS
#

bundle_matrix.ts view source

readonly { id: BundleView; label: string; }[] import {BUNDLE_VIEWS} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

Both views, with their labels, in display order.

BundleCompression
#

bundle_matrix.ts view source

BundleCompression

type "raw" | "gzip" | "brotli"

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

Which size of a bundle to show: the minified bytes, or those bytes compressed.

BundleSelection
#

bundle_matrix.ts view source

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

What the bundle tables show.

langs

type readonly string[]

set

The id of the set of several languages to sum and to read wasm and CSS from.

type string

compression

type BundleCompression

BundleView
#

bundle_matrix.ts view source

BundleView

type "incremental" | "totals"

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

Which bundle table to show: what each language costs, or each set's total.

CombinedSet
#

bundle_matrix.ts view source

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

Sets of several languages that hold the same ones, shown as one row.

ids

The ids of the sets that hold these languages, the first being the one measured.

type string[]

label

type string

langs

type string[]

footnote

type string | null

find_core_set
#

bundle_matrix.ts view source

(sets: readonly { id: string; label: string; langs: string[]; footnote: string | null; }[]): { id: string; label: string; langs: string[]; footnote: string | null; } | null import {find_core_set} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The set with no language: a library's runtime floor.

sets

type readonly BenchSet[]

returns

BenchSet | null

find_single_set
#

bundle_matrix.ts view source

(sets: readonly { id: string; label: string; langs: string[]; footnote: string | null; }[], lang: string): { id: string; label: string; langs: string[]; footnote: string | null; } | null import {find_single_set} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The set holding one language alone.

sets

type readonly BenchSet[]

lang

type string

returns

BenchSet | null

find_timed_set
#

bundle_matrix.ts view source

(sets: readonly { id: string; label: string; langs: string[]; footnote: string | null; }[], langs: readonly { id: string; label: string; timed: boolean; }[]): { id: string; label: string; langs: string[]; footnote: string | null; } | null import {find_timed_set} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The set of every timed language, which every library claims.

sets

type readonly BenchSet[]

langs

type readonly BenchLang[]

returns

BenchSet | null

find_without_set
#

bundle_matrix.ts view source

(sets: readonly { id: string; label: string; langs: string[]; footnote: string | null; }[], langs: readonly { id: string; label: string; timed: boolean; }[], lang: string): { id: string; label: string; langs: string[]; footnote: string | null; } | null import {find_without_set} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The set of every timed language but one.

sets

type readonly BenchSet[]

langs

type readonly BenchLang[]

lang

type string

returns

BenchSet | null

INSTALL_MEASURES
#

bundle_matrix.ts view source

readonly { id: "bytes" | "packages" | "files"; label: string; unit: MatrixUnit; }[] import {INSTALL_MEASURES} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The numbers of an install footprint, with their labels and units, in display order.

to_bundle_beside_group
#

bundle_matrix.ts view source

(results: MatrixResults, selection: Pick<BundleSelection, "set" | "compression">): MatrixGroup import {to_bundle_beside_group} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

What a page loads beside the JS, kept out of the figures above it: the wasm binary, the theme stylesheet, and which color schemes that theme covers, since a theme with two is larger than a theme with one.

results

selection

type Pick<BundleSelection, "set" | "compression">

returns

MatrixGroup

to_bundle_cost_groups
#

bundle_matrix.ts view source

(results: MatrixResults, selection: BundleSelection): MatrixGroup[] import {to_bundle_cost_groups} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The incremental-cost view: the core set, what each selected language adds to it, and for the selected set the sum of its languages beside its measured total.

results

selection

returns

MatrixGroup[]

the groups, none for a file that measured no bundle

to_bundle_increment_entry
#

bundle_matrix.ts view source

(results: Pick<MatrixResults, "sets" | "bundle">, library: string, lang: string, compression: BundleCompression): MatrixEntry import {to_bundle_increment_entry} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

What one language adds to one library: its single-language set less the core set. Unsupported when the library doesn't claim the language.

results

type Pick<MatrixResults, "sets" | "bundle">

library

type string

lang

type string

compression

returns

MatrixEntry

to_bundle_loaded_entry
#

bundle_matrix.ts view source

(results: Pick<MatrixResults, "bundle">, library: string, set: { id: string; label: string; langs: string[]; footnote: string | null; } | null, compression: BundleCompression): MatrixEntry import {to_bundle_loaded_entry} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

Everything a page loads for one library over one set: the JS, the wasm binary, and the theme stylesheet, each compressed on its own and added up. A library with no binary or no stylesheet adds nothing for it, so a library whose engine ships as wasm is compared on all it ships.

results

type Pick<MatrixResults, "bundle">

library

type string

set

type BenchSet | null

compression

returns

MatrixEntry

to_bundle_marginal_entry
#

bundle_matrix.ts view source

(results: Pick<MatrixResults, "langs" | "sets" | "bundle">, library: string, lang: string): MatrixEntry import {to_bundle_marginal_entry} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

What one timed language adds to a bundle of all the others: the set of every timed language less the set without it, in minified bytes. Unlike to_bundle_increment_entry, this never carries runtime that any language needs, which the first language loaded pays for. It is never compressed: compression works across a whole bundle, so the difference of two compressed bundles doesn't isolate one language's share, and can come out negative. A language the others already hold adds nothing. Unmeasured when the file holds neither set.

results

type Pick<MatrixResults, "langs" | "sets" | "bundle">

library

type string

lang

type string

returns

MatrixEntry

to_bundle_size_entry
#

bundle_matrix.ts view source

(results: Pick<MatrixResults, "bundle">, library: string, set: { id: string; label: string; langs: string[]; footnote: string | null; } | null, compression: BundleCompression): MatrixEntry import {to_bundle_size_entry} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The JS size of one library over one set.

results

type Pick<MatrixResults, "bundle">

library

type string

set

type BenchSet | null

compression

returns

MatrixEntry

to_bundle_sum_entry
#

bundle_matrix.ts view source

(results: Pick<MatrixResults, "sets" | "bundle">, library: string, langs: readonly string[], compression: BundleCompression): MatrixEntry import {to_bundle_sum_entry} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The core set plus what each language of a set adds, for one library. It equals the set's measured size only when the languages share no code, so the two are shown side by side. Unsupported, naming the languages, when the library lacks any of them.

results

type Pick<MatrixResults, "sets" | "bundle">

library

type string

langs

type readonly string[]

compression

returns

MatrixEntry

to_bundle_total_groups
#

bundle_matrix.ts view source

(results: MatrixResults, selection: Pick<BundleSelection, "set" | "compression">): MatrixGroup[] import {to_bundle_total_groups} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The set totals: the core set and every set of several languages, each as it was measured, then the same sets with everything a page loads added up.

results

selection

type Pick<BundleSelection, "set" | "compression">

returns

MatrixGroup[]

the groups, none for a file that measured no bundle

to_combined_set_note
#

bundle_matrix.ts view source

(set: CombinedSet): string import {to_combined_set_note} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

A combined set's languages, its footnote, and that it stands for several sets, when it does.

set

returns

string

to_combined_sets
#

bundle_matrix.ts view source

(sets: readonly { id: string; label: string; langs: string[]; footnote: string | null; }[], langs: readonly { id: string; label: string; timed: boolean; }[]): CombinedSet[] import {to_combined_sets} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The sets of several languages, with sets that hold the same languages merged into one entry that names them all. Two such sets measure the same bundle, so showing both would be a duplicate row that says nothing. The sets of every timed language but one are left out: they are there for what each language adds (to_bundle_marginal_entry), not to be shown.

sets

type readonly BenchSet[]

langs

type readonly BenchLang[]

returns

CombinedSet[]

to_install_group
#

bundle_matrix.ts view source

(results: MatrixResults): MatrixGroup | null import {to_install_group} from '@ryanatkn/syntax-highlighter-bench/bundle_matrix.js';

The install footprints: what npm install of each library adds, as a row for each number. The footprint is everything the packages ship, every language, theme, and type declaration included, and not what a page loads, which the bundle tables show.

results

returns

MatrixGroup | null

the group, or null for a file that measured no footprint

Depends on
#

Imported by
#