2.0.6 • Published 4 years ago

simple_async_perf_tester v2.0.6

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

Simple, independent async code performance tester 🕵️

Install

npm i --save-dev simple_async_perf_tester or yarn --dev simple_async_perf_tester

Usage

const perfTest = require("simple_async_perf_tester"); // or ES6 import

perfTest({
  numberOfRuns: 5,
  scriptName: "script.js",
});
perfTest({ scriptName: "anotherScript.js" });

// Example output:
/**
 * Running Performance Testing 🕵️‍♂️
 * - Number of runs: 200
 * - Test script: example.js
 *
 * RESULT:
 * - Average parsing time is 5.98ms
 */

Options

Options to pass to the performace execution function

const options = {
  numberOfRuns: 100, // OPTIONAL. A positive integer. Defaults to 50
  scriptName: "parse.js", // Path to the testing script that outputs delta execution time. See `examples` folder
}

Example test scripts

Check examples folder

Reason

I decided to save this example repo because of unexpected issues I ran into while testing async code execution using Promise.all. What I observed is that by increasing the number of runs, the average execution time increased linearly.

By moving each execution to its own process, the test is unbiased and independent of current process resources being taken by past executions. Unfortunately, the approach here makes the execution of the performance test longer.

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago