Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

node.js benchmarking & performance analysis utilities

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

Really easy to use benchmarking utility for async code execution in node.js. Currently not a lot handled for you other than executing your code x number of times and providing the time it took to do so. Used for benchmarks in node-postgres.

Example

var bencher = require('path/to/bencher/lib/folder');
var bench = bencher({
  name: 'my benchmark',
  repeat: 100,
  actions:[{
    name: 'first action',
    run: function(next) {
      //do something
      setTimeout(function() {
        //call next when you're done
        next()
      }, 100)
    }
  },{
    name: 'second action',
    run: function(next) {
      //do something...
      //call next when you're done
      next()
    }
  }]
})

bench(function(result) {
  result.actions.forEach(function(action) {
    console.log(aciton.name);
    action.repeats.forEach(function(repeat) {
      console.log(repeat.start) // -- date object
      console.log(repeat.end)  // -- date object
    })
  })
})

TODO

  • better documentation
  • provide summary and helper info for average runtimes
  • how to bench things which take less than a milisecond?
Something went wrong with that request. Please try again.