Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emilhein/optifunc
NPM module to make optimizations and tests on your functions
https://github.com/emilhein/optifunc
helper-functions nodejs npm performance statistics testing
Last synced: about 2 months ago
JSON representation
NPM module to make optimizations and tests on your functions
- Host: GitHub
- URL: https://github.com/emilhein/optifunc
- Owner: emilhein
- Created: 2018-04-29T16:05:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:52:35.000Z (almost 2 years ago)
- Last Synced: 2024-09-17T20:27:17.348Z (3 months ago)
- Topics: helper-functions, nodejs, npm, performance, statistics, testing
- Language: JavaScript
- Homepage:
- Size: 200 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Coverage Status](https://coveralls.io/repos/github/emilhein/optifunc/badge.svg?branch=master)](https://coveralls.io/github/emilhein/optifunc?branch=master)
[![Build Status](https://travis-ci.org/emilhein/optifunc.svg?branch=master)](https://travis-ci.org/emilhein/optifunc)## What do i do
For now i only have two functions
#### 1. compare(function1, function2, input1, input2, ...)
simple check if two functions return the same output
#### 2. run([function1, function2, ...], input1, input2,input3, ...)
run x amount of functions with same input and out some execution time statistics.
## basic usage
```js
let { run, compare } = require("optifunc");let func1 = a => a;
let func2 = a => a;compare({functions : [func1, func2], args: ["Someinput"] )
.then(res => run({ functions: [func1, func2] }))
.then(stats => {
console.log(stats);
});
// Output
// [ { function: 'func1', max: 0.034, min: 0.001, avg: '0.005' },
// { function: 'func2', max: 0.001, min: 0.001, avg: '0.001' } ]//Or only the run function
run({ functions: [func1, func2], runTimes: 20 }, "test").then(res => console.log(res));
```