testify-benchmark

0.1.0 • Public • Published

Testify Benchmark

npm install testify-benchmark
 
Benchmark = require("../src/benchmark")
 
saneTimeout = (ms, fn) ->
  setTimeout(fnms)
 
async_benchmark = Benchmark.measure "asynchronousness"(bm) ->
 
  bm.measure "composite"(context) ->
    saneTimeout 13->
      context.measure "composite sync"->
        string = ""
        for i in [1..3000]
          string += i.toString()
 
      context.measure "composite inner"(context) ->
        saneTimeout 8->
          context.finish()
 
async_benchmark.run {iterations: 12}(results) ->
  for keyvalue of results.data
    console.log keyJSON.stringify(value.data.summarize()null2)
 
 

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
}


Readme

Keywords

none

Package Sidebar

Install

npm i testify-benchmark

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • automatthew