Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including bencher with all npm packages installed. Try it out:

var bencher = require("bencher")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

bencher v0.0.2

Benchmarkin' library

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.


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

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


  • better documentation
  • provide summary and helper info for average runtimes
  • how to bench things which take less than a milisecond?
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free