tinybench - v6.2.0
    Preparing search index...

    Function estimateResolution

    • Estimates timer resolution heuristically from a latency sample set.

      Returns the smallest positive sample occurring at least twice, or the smallest positive sample if none repeats. The repeated-value branch ignores a single isolated low sample; the fallback does not offer that protection. This is an observed task duration, not a guaranteed bound on timer resolution.

      Exploits the sorted-ascending invariant: equal values are contiguous, so the first strictly-positive value with an equal successor is the smallest reproduced value, and the first strictly-positive value is the fallback minimum. Runs in O(1) extra space with an early exit.

      Parameters

      Returns number | undefined

      the estimated resolution in milliseconds, or undefined when no strictly positive sample is observed

    Sponsor
    SponsoredKunjungi sekarang
    Promo