Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "timed"

Index

Functions

Const timed

  • timed<T>(fn: () => T, prefix?: string): T
  • Calls function fn without args, prints elapsed time and returns fn's result. The optional prefix will be displayed with the output, allowing to label different measurements.

    Type parameters

    • T

    Parameters

    • fn: () => T

      function to time

        • (): T
        • Returns T

    • Default value prefix: string = ""

      log prefix

    Returns T

Const timedResult

  • Similar to timed, but produces no output and instead returns tuple of fn's result and the time measurement (in milliseconds).

    Type parameters

    • T

    Parameters

    • fn: () => T

      function to time

        • (): T
        • Returns T

    Returns TimingResult<T>

Generated using TypeDoc