A class that represents each benchmark task in Tinybench. It keeps track of the results, name, Bench instance, the task function and the number times the task function has been executed.

Hierarchy

Constructors

  • Parameters

    • bench: BenchFactory
    • name: string
    • fn: Fn
    • Optional opts: FnOptions

    Returns BenchTask

Properties

fn: Fn
name: string

task name

opts: FnOptions

Task options

the result object

runs: number

Methods

  • Type Parameters

    • K extends TaskEvents

    • T = TaskEventsMap[K]

    Parameters

    • type: K
    • listener: T
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    MDN Reference

    Parameters

    Returns boolean

  • Type Parameters

    • K extends TaskEvents

    • T = TaskEventsMap[K]

    Parameters

    • type: K
    • listener: T
    • Optional options: boolean | EventListenerOptions

    Returns void

  • reset the task to make the Task.runs a zero-value and remove the Task.result object

    Returns void

  • run the current task and write the results in Task.result object

    Returns Promise<BenchTask>

  • change the result object values

    Parameters

    Returns void

  • warmup the current task

    Returns Promise<void>

Generated using TypeDoc