tinybench - v6.0.0
    Preparing search index...

    Interface BenchOptions

    Bench options

    interface BenchOptions {
        concurrency?: Concurrency;
        iterations?: number;
        name?: string;
        now?: NowFn;
        retainSamples?: boolean;
        setup?: Hook;
        signal?: AbortSignal;
        teardown?: Hook;
        threshold?: number;
        throws?: boolean;
        time?: number;
        timestampProvider?: TimestampProvider | TimestampFns;
        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

    The 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.

    retainSamples?: boolean

    Keep samples for statistics calculation

    false
    
    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

    Number.POSITIVE_INFINITY
    
    throws?: boolean

    Throws if a task fails.

    false
    
    time?: number

    Time needed for running a benchmark task in milliseconds.

    1000
    
    timestampProvider?: TimestampProvider | TimestampFns

    The timestamp provider used by the benchmark. By default 'performance.now' will be used.

    warmup?: boolean

    Warmup benchmark.

    true
    
    warmupIterations?: number

    Warmup iterations.

    16
    
    warmupTime?: number

    Warmup time in milliseconds.

    250