brolly
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -13,4 +13,4 @@ 'use strict'; | ||
function failure(error) { | ||
process.send({ success: false, error }); | ||
process.exit(1); | ||
process.send({ success: false, error: error.message }); | ||
process.exit(0); | ||
} | ||
@@ -17,0 +17,0 @@ |
{ | ||
"name": "brolly", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"description": "benchmark in style", | ||
"main": "bin/index.js", | ||
"jesnext:main": "src/index.js", | ||
"jsnext:main": "src/index.js", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "build": "babel src --out-dir bin", |
@@ -7,2 +7,5 @@ # brolly | ||
- forks each bench function as child process | ||
- | ||
## Install | ||
@@ -32,5 +35,5 @@ | ||
### `benchmark(benches) : Function` | ||
### `benchmark(name, benches) : Function` | ||
Execute a suite of benchmark functions. | ||
Create a benchmark suite. | ||
@@ -40,8 +43,12 @@ - __name__ {String} name of the benchmark suite | ||
Returns a `bench`. | ||
Returns a bench function. | ||
### `bench.run() : self` | ||
### `bench(iterations) : self` | ||
Run the benchmark suite. | ||
- __iterations__ {Number} number of times to run each bench function | ||
Returns self. | ||
### `bench.print() : self` | ||
@@ -51,2 +58,4 @@ | ||
Returns self. | ||
## Example | ||
@@ -57,5 +66,5 @@ | ||
const bench = benchmark('wait', [ | ||
const bench = benchmark('timeout', [ | ||
// use done callback | ||
function setTimeout (done) { | ||
function timeout (done) { | ||
setTimeout(done, 1000) | ||
@@ -70,4 +79,4 @@ }, | ||
// run and then print the results to console | ||
bench.run().print() | ||
// run each bench 1000 times and then print the results | ||
bench(1000).print() | ||
``` | ||
@@ -74,0 +83,0 @@ |
@@ -13,4 +13,4 @@ 'use strict' | ||
function failure (error) { | ||
process.send({success: false, error}) | ||
process.exit(1) | ||
process.send({success: false, error: error.message}) | ||
process.exit(0) | ||
} | ||
@@ -17,0 +17,0 @@ |
Sorry, the diff of this file is not supported yet
45559
90
14
238