tinybench - v6.2.0
    Preparing search index...

    Interface FnReturnedObject

    A possible object returned by task functions to override default behaviors, like the duration of the function itself. Annotate a callback return as this type (Promise<FnReturnedObject> for async callbacks), or use satisfies FnReturnedObject on the returned object to check measurement fields. Annotating the callback as Fn alone does not check them. Numeric values are still validated at runtime.

    interface FnReturnedObject {
        overriddenDuration?: number;
        overriddenIterationCost?: number;
    }
    Index
    overriddenDuration?: number

    An overridden duration for the task function, to be used instead of the duration measured by tinybench when running the benchmark.

    This can be useful to measure parts of the execution of a function that are hard to execute independently.

    overriddenIterationCost?: number

    The declared duration of the whole task function call, in milliseconds, consumed by the sequential time and warmupTime budgets. If absent or invalid, the budget uses the sample before timer-overhead correction.

    Must be finite and non-negative (0 and -0 included). Own and inherited properties are supported; presence-check and access errors are treated as absence. Repeated zero costs cannot satisfy a positive time budget.

    Applies per task with concurrency: 'bench' and in Task.warmupSync regardless of concurrency. Task-concurrent run() and warmup() use the clock and do not inspect this field: neither its presence nor its value is read. Does not affect samples, timer-overhead correction or timer diagnostics.