Testify Benchmark
npm install testify-benchmark
Benchmark = require"../src/benchmark" = setTimeoutfnms async_benchmark = Benchmarkmeasure "asynchronousness" bmmeasure "composite" saneTimeout 13-> contextmeasure "composite sync"-> string = "" for i in 1..3000 string += itoString contextmeasure "composite inner" saneTimeout 8-> contextfinish async_benchmarkrun iterations: 12 for keyvalue of resultsdata consolelog keyJSONstringifyvaluedatasummarizenull2
Output:
Iteration: 1...5....10..
composite {
"sample_size": 12,
"mean": 24123.583333333332,
"max": 32436,
"median": 23347.5,
"min": 22442,
"stdDev": 2578.911639249308
}
composite sync {
"sample_size": 12,
"mean": 1012.4166666666666,
"max": 8158,
"median": 307,
"min": 229,
"stdDev": 2159.6584397512697
}
composite inner {
"sample_size": 12,
"mean": 8340.25,
"max": 9304,
"median": 8202,
"min": 7946,
"stdDev": 365.9925147230929
}