A simple mocha-esque ui for benchmark.js
Last updated 7 years ago by phpnode .
Original npm · Tarball · package.json
$ cnpm install bencha 
SYNC missed versions from official npm registry.


Mocha-esque UI for the excellent benchmark.js JavaScript benchmarking library. Records benchmark history and flags performance improvements and regressions.


npm install bencha -g

Writing Benchmarks

Create a bench directory in your project. In the bench directory, create an index.js (or, e.g.

compare("RegExp vs String::indexOf", function(){
  var input = "demo.string"
  benchmark("RegExp", function(){
  benchmark("String::indexOf", function(){
    input.indexOf(".") > -1;

suite("My Feature", function(){
  benchmark("foo() no arguments", function(){
  benchmark("foo() with arguments", function(){
    foo(true, false);
  benchmark("bar()", function(){

The above defines two benchmark suites, the first is a comparison suite, comparison suites compare the results of each benchmark within the suite, declaring one the winner. The second declaration defines a suite containing three separate benchmarks that are related but not explicitly compared with each other.

To split your benchmarks into seperate files, simply require() them from the main index.js file.

Running Benchmarks

From your project root (or the directory containing the bench folder), run:


This will run the benchmarks with the default spec reporter, recording the results in bench/history.json

Run bencha --help for more options.



Current Tags

  • 0.0.2                                ...           latest (7 years ago)

2 Versions

  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 2
Dependencies (3)
Dev Dependencies (0)
Dependents (1)

Copyright 2014 - 2017 © |