For now i only have two functions
simple check if two functions return the same output
run x amount of functions with same input and out some execution time statistics.
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));