tinybench - v5.1.0
    Preparing search index...

    Interface BenchOptions

    Bench options

    interface BenchOptions {
        concurrency?: Concurrency;
        iterations?: number;
        name?: string;
        now?: NowFn;
        setup?: Hook;
        signal?: AbortSignal;
        teardown?: Hook;
        threshold?: number;
        throws?: boolean;
        time?: number;
        warmup?: boolean;
        warmupIterations?: number;
        warmupTime?: number;
    }

    Hierarchy (View Summary)

    Index

    Properties

    concurrency?: Concurrency

    Executes tasks concurrently based on the specified concurrency mode.

    • When mode is set to null (default), concurrency is disabled.
    • When mode is set to 'task', each task's iterations (calls of a task function) run concurrently.
    • When mode is set to 'bench', different tasks within the bench run concurrently.
    iterations?: number

    number of times that a task should run if even the time option is finished

    64
    
    name?: string

    benchmark name

    now?: NowFn

    function to get the current timestamp in milliseconds

    setup?: Hook

    setup function to run before each benchmark task (cycle)

    signal?: AbortSignal

    An AbortSignal for aborting the benchmark

    teardown?: Hook

    teardown function to run after each benchmark task (cycle)

    threshold?: number

    The maximum number of concurrent tasks to run

    Infinity
    
    throws?: boolean

    Throws if a task fails

    false
    
    time?: number

    time needed for running a benchmark task (milliseconds)

    1000
    
    warmup?: boolean

    warmup benchmark

    true
    
    warmupIterations?: number

    warmup iterations

    16
    
    warmupTime?: number

    warmup time (milliseconds)

    250