@kwiwk/bench
Benchmarking utilities.
Last updated 2 years ago by russleyshaw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @kwiwk/bench 
SYNC missed versions from official npm registry.

bench

A simple benchmarking utility.

Build Status Coveralls github npm npm

Kwiwk Logo

Table Of Contents

Description

View examples here

Getting Started

  • Install Node v8 LTS here.

Documentation

Example: Testing promisified setTimeout.

// Import Benchmarking utility
import { Bench } from "@kwiwk/bench";

// Some iterable helper utilities
import { itMap, itRange, itStutter } from "./it_utils";

// Create a new Bench utility.
const bench = new Bench({
    inputs: itMap(itRange(0, 100), i => ({ label: `${i}`, value: i }))
});

// Time our test function
bench.addTestAsync("delayMs", async input => delayMs(input));

// Output difference between result and expected result.
bench.addRaw("diff", (input, results) => {
    return (results["delayMs"] - input).toString();
});

// Run the benchmarking.
bench.run("./delay.csv");

// Function under test
async function delayMs(ms: number): Promise<void> {
    return new Promise<void>((resolve, reject) => setTimeout(resolve, ms));
}

View the API docs here.

View the coverage report here.

License

View the license here.

Changelog

View the changelog here.

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |