Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

test-performance

nickheal745MIT1.1.3TypeScript support: included

Simplifying testing performance

test, testing, performance, perf

readme

test-performance

Codecov Coverage GitHub

Purpose

test-performance is a package designed to simplify testing performance.

Performance is notoriously difficult to test in a meaningful way. It varies by network, machine, and all sorts of circumstances outside our control. And it's affected by our psychology; a page that loads something quickly feels faster even if it is just a skeleton of how the page will look.

That doesn't change the fact that performance is meaningful, and we shouldn't disregard it because it's difficult.

This package distills performance down to a single millisecond score that it expects a function to take to run. It can't take in to account every machine, browser, or network, but it provides a baseline based on an average machine, that we can test against.

I would recommend using this more in integration than unit tests, unless you are confident that you have a distinct unit that is a bottleneck.

Installation

Add to your project using npm i -D test-performance

Usage

import getPerformanceScore from 'test-performance';

const expectedPerformanceInMs = await getPerformanceScore(() => 1 + 1);

// returns the expected number of ms that the function will take to run on an average machine

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.1.3 (2020-09-12)

1.1.2 (2020-05-01)

1.1.1 (2020-05-01)

1.1.0 (2020-05-01)

Features