Benchmark
Counts how much time, memory, cpu spent on specific function.
Additional outputs:
- Average error per function.
- Difference between best time function and current one.
Script
add this script in your package.json file
"scripts": {
"benchmark": "node ./node_modules/benchmark-javascript/dist/index.js"
},
Start command
npm run benchmark path iterations runs
path
: /folder/folder/file.extension
iterations
: should be number
runs
: should be number
File should look like
export const functions = {
'title': 'functions.ts',
'tests': [
{
'title': 'Function Name',
'func': (): number =>{
// function body
},
}
]
};