Visual Bench
Synopsis
Visual Bench sits on top of bench and it has a dual purpose:
- Automatically save the benchmarks into a data file in JSON format
- Allow the results to be visualized in a web browser
Installation
npm install visualbench -g
Usage
Generating some data
Load the module and supply an id to use as a data key, and optionally a file where to store the data.
var bench = 'emit:0.0.4'
Showing the data
Start the server with vbserver
.
For more options, run vbserver --help
.
For debugging, run DEBUG=http vbserver
.
Example
First, generate some data.
var bench = 'testId' // Straight from the `bench` examplesvar foo = 1 bar = 2 { var _ = foo foo = bar bar = _} { foo = bar bar = foo0} { {foo=x;bar=y}barfoo} exportscompare = tmpvar: tmpvar arrswap: arrswap fnswap: fnswap {} bench
This will generate the data.json
file, containing something similar to the following data.
"var-swap": "tmpvar": 11752747252747252 11555344655344656 11363636363636363 9973626373626373 9826673326673327 "arrswap": 6034165834165834 5848951048951049 5720279720279721 5467232767232767 5362137862137862 "fnswap": 5576623376623377 5454845154845155 5173426573426573 5165034965034965 51682317682317684 "nil function": 14961838161838162 14975724275724276 14454845154845156 12786913086913087 12764735264735264
Start the web server.
vbserver
Point your web browser at http://localhost:8080
Enjoy the results!
Credits
Special thanks to...