@webmangler/benchmarking
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

WebMangler Benchmarking Utilities

NPM Package

A collection of benchmarking utilities for WebMangler packages and plugins.

Usage

Install @webmangler/benchmarking, e.g.:

$ npm install @webmangler/benchmarking --save-dev

Import and use the benchmarking utilities in your benchmark, e.g.:

// my-module.bench.ts

import { benchmarkFn, getRuntimeBudget } from "@webmangler/benchmarking";

import slowFunction from "../my-module";

suite("My benchmark", function() {
  test("normal usage", function() {
    const runtimeBudget = getRuntimeBudget(5); // In milliseconds

    const benchmarkResult = benchmarkFn({
      fn: () => slowFunction("foo", "bar"),
    });
    expect(benchmarkResult.medianDuration).to.be.below(runtimeBudget);
  });
});

Readme

Keywords

none

Package Sidebar

Install

npm i @webmangler/benchmarking

Weekly Downloads

0

Version

0.1.1

License

Unlicense

Unpacked Size

11.2 kB

Total Files

13

Last publish

Collaborators

  • ericcornelissen