benchmark_format.ts

Declarations
#

7 declarations

view source

benchmark_format_json
#

benchmark_format.ts view source

(results: BenchmarkResult[], options?: BenchmarkFormatJsonOptions | undefined): string

Format results as JSON.

results

- Array of benchmark results

type BenchmarkResult[]

options?

- Formatting options

type BenchmarkFormatJsonOptions | undefined
optional

returns

string

JSON string

examples

Example 1

benchmark_format_markdown
#

benchmark_format.ts view source

(results: BenchmarkResult[], baseline?: string | undefined): string

Format results as a Markdown table with key metrics. All times use the same unit for easy comparison.

results

- Array of benchmark results

type BenchmarkResult[]

baseline?

- Optional task name to use as baseline for comparison (defaults to fastest)

type string | undefined
optional

returns

string

Formatted markdown table string

examples

Example 1

benchmark_format_markdown_grouped
#

benchmark_format.ts view source

(results: BenchmarkResult[], groups: BenchmarkGroup[]): string

Format results as grouped Markdown tables with headers between groups.

results

- Array of benchmark results

type BenchmarkResult[]

groups

- Array of group definitions

type BenchmarkGroup[]

returns

string

Formatted markdown string with group headers and tables

examples

Example 1

benchmark_format_number
#

benchmark_format.ts view source

(n: number, decimals?: number) => string

Format a number with fixed decimal places and thousands separators.

see also

  • {@link format_number} in maths.ts for the underlying implementation.

benchmark_format_table
#

benchmark_format.ts view source

(results: BenchmarkResult[], baseline?: string | undefined): string

Format results as an ASCII table with percentiles, min/max, and relative performance. All times use the same unit for easy comparison.

results

- Array of benchmark results

type BenchmarkResult[]

baseline?

- Optional task name to use as baseline for comparison (defaults to fastest)

type string | undefined
optional

returns

string

Formatted table string with enhanced metrics

examples

Example 1

benchmark_format_table_grouped
#

benchmark_format.ts view source

(results: BenchmarkResult[], groups: BenchmarkGroup[]): string

Format results as a grouped table with visual separators between groups.

results

- Array of benchmark results

type BenchmarkResult[]

groups

- Array of group definitions

type BenchmarkGroup[]

returns

string

Formatted table string with group separators

examples

Example 1

BenchmarkFormatJsonOptions
#

benchmark_format.ts view source

BenchmarkFormatJsonOptions

pretty

Whether to pretty-print (default: true)

type boolean

include_timings

Whether to include raw timings array (default: false, can be large)

type boolean

Depends on
#

Imported by
#