• High, Low, Average

    Wedgetail gives you accurate timings for the best, worst and average timings.

  • Measure thousands of executions

    Get accurate statistics out of the box, by setting `numberOfExecutions` to at least 5000.

  • Percentiles

    Wedgetail gives you the timings for the 99th, 95th, 90th, and 10th percentiles.

  • Expected timings

    Pass an object with the timings your test should be under and get a pass or fail back.

import test from "ava";

import { timeExecution } from "wedgetail";

test("Can time a function", async t => {

// This object contains a definition of the threshold
// at which your function is too slow.
// All timings are in milliseconds(ms)
const allowedPerformance = {
average: 0.001,
high: 1,
low: 0.001,
percentiles: {
ninetieth: 0.0004,
ninetyFifth: 0.001,
ninetyNinth: 0.001,
tenth: 0.0005,

const timings = await timeExecution({
expectedTimings: allowedPerformance,
numberOfExecutions: 5000,
// By using an anonymous arrow function you should
// be able to maintain the correct scope
// of `this`.
callback: () => {
// Your function goes here

// You can use any testing or assertion library.
// if the timings are below your expected values then
// `timings.results.passed` will be `true`
t.true(timings.results.passed, "timings failed");