{"_id":"bench","_rev":"209058","name":"bench","description":"A little utility for doing side-by-side benchmarks in nodejs","dist-tags":{"latest":"0.3.6"},"maintainers":[{"name":"isaacs","email":""}],"time":{"modified":"2021-06-03T15:24:15.000Z","created":"2011-03-31T06:08:23.016Z","0.3.6":"2015-10-12T18:52:35.237Z","0.3.5":"2013-01-09T02:04:49.353Z","0.3.4":"2011-12-29T21:44:30.157Z","0.3.3":"2011-11-22T01:46:43.906Z","0.3.2":"2011-07-17T21:28:11.032Z","0.3.1":"2011-03-31T06:08:23.016Z","0.3.0":"2011-03-31T06:08:23.016Z","0.2.0":"2011-03-31T06:08:23.016Z"},"users":{"pid":true,"netpoetica":true,"nxc":true,"archcorsair":true,"neomorphic":true},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"versions":{"0.3.6":{"name":"bench","version":"0.3.6","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench.js","gitHead":"6ecf36885a838b01a1e266cb375e4322611fc836","_id":"bench@0.3.6","scripts":{},"_shasum":"2f204bd2c0e3cc71c3ab4b6a0adbbc5c0ecad096","_from":".","_npmVersion":"3.3.2","_nodeVersion":"4.0.0","_npmUser":{"name":"isaacs","email":"isaacs@npmjs.com"},"dist":{"shasum":"2f204bd2c0e3cc71c3ab4b6a0adbbc5c0ecad096","size":50259,"noattachment":false,"key":"/bench/-/bench-0.3.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.3.6.tgz"},"maintainers":[{"name":"isaacs","email":""}],"directories":{},"publish_time":1444675955237,"_cnpm_publish_time":1444675955237,"_hasShrinkwrap":false},"0.3.5":{"name":"bench","version":"0.3.5","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench.js","readmeFilename":"README.md","_id":"bench@0.3.5","dist":{"shasum":"1ae22b257d18168941288da8274a5819f0df4b85","size":50183,"noattachment":false,"key":"/bench/-/bench-0.3.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.3.5.tgz"},"_npmVersion":"1.1.70","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"directories":{},"publish_time":1357697089353,"_cnpm_publish_time":1357697089353,"_hasShrinkwrap":false},"0.3.4":{"name":"bench","version":"0.3.4","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench.js","_npmUser":{"name":"isaacs","email":"i@izs.me"},"_id":"bench@0.3.4","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-beta-7","_nodeVersion":"v0.6.7-pre","_defaultsLoaded":true,"dist":{"shasum":"a1d685db25b764a2cbe08412cdc7b53633d3ffcb","size":45354,"noattachment":false,"key":"/bench/-/bench-0.3.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.3.4.tgz"},"maintainers":[{"name":"isaacs","email":""}],"directories":{},"publish_time":1325195070157,"_cnpm_publish_time":1325195070157,"_hasShrinkwrap":false},"0.3.3":{"name":"bench","version":"0.3.3","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench.js","_npmUser":{"name":"isaacs","email":"i@izs.me"},"_id":"bench@0.3.3","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-alpha","_nodeVersion":"v0.6.2-pre","_defaultsLoaded":true,"dist":{"shasum":"033b224b43b8d19104d724188c4e04ea7c61354d","size":42914,"noattachment":false,"key":"/bench/-/bench-0.3.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.3.3.tgz"},"maintainers":[{"name":"isaacs","email":""}],"directories":{},"publish_time":1321926403906,"_cnpm_publish_time":1321926403906,"_hasShrinkwrap":false},"0.3.2":{"name":"bench","version":"0.3.2","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench.js","_npmJsonOpts":{"file":"/Users/isaacs/.npm/bench/0.3.2/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"bench@0.3.2","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.17","_nodeVersion":"v0.4.9","_defaultsLoaded":true,"dist":{"shasum":"ed515b24cff129b2b31739c79cf457c3cd6b0827","size":10494,"noattachment":false,"key":"/bench/-/bench-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.3.2.tgz"},"scripts":{},"directories":{},"publish_time":1310938091032,"maintainers":[{"name":"isaacs","email":""}],"_cnpm_publish_time":1310938091032,"_hasShrinkwrap":false},"0.3.1":{"name":"bench","version":"0.3.1","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench","_id":"bench@0.3.1","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"shasum":"5772d326717f258789b9d78772d65e65b6f50e9a","size":7794,"noattachment":false,"key":"/bench/-/bench-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.3.1.tgz"},"directories":{},"publish_time":1301551703016,"maintainers":[{"name":"isaacs","email":""}],"_cnpm_publish_time":1301551703016,"_hasShrinkwrap":false},"0.3.0":{"name":"bench","version":"0.3.0","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench","_id":"bench@0.3.0","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"shasum":"e6aaa81668cef16afbf2c443113e6610427d1484","size":7724,"noattachment":false,"key":"/bench/-/bench-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.3.0.tgz"},"directories":{},"publish_time":1301551703016,"maintainers":[{"name":"isaacs","email":""}],"_cnpm_publish_time":1301551703016,"_hasShrinkwrap":false},"0.2.0":{"name":"bench","version":"0.2.0","description":"A little utility for doing side-by-side benchmarks in nodejs","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me"},"bin":{"node-bench":"./lib/cli-wrapper.js"},"main":"lib/bench","_id":"bench@0.2.0","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"shasum":"4dcd4b7159ea3f0e1cd1cd29967daed7ef17236e","size":6214,"noattachment":false,"key":"/bench/-/bench-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/bench/download/bench-0.2.0.tgz"},"directories":{},"publish_time":1301551703016,"maintainers":[{"name":"isaacs","email":""}],"_cnpm_publish_time":1301551703016,"_hasShrinkwrap":false}},"readme":"# node bench\n\nA little utility for doing side-by-side benchmarks in\n[nodejs](http://nodejs.org).\n\nThis is not for benchmarking your HTTP servers.  Use\n[ab](http://httpd.apache.org/docs/2.0/programs/ab.html) for that.\n\n## Installation\n\n    npm install bench\n\n## Usage\n\nWrite your script like this:\n\n    exports.compare = {\n      \"function wrapper\" : function () {\n        var x = (function (a) {\n          return a;\n        })(\"foo\");\n      },\n      \"with(){} wrapper\" : function () {\n        var x;\n        with ({a : \"foo\"}) {\n          x = a;\n        }\n      }\n      \"no wrapper\" : function () {\n        var a = \"foo\";\n        var x = a;\n      }\n    };\n    require(\"bench\").runMain()\n\nThen, start it up with node.\n\n    $ node my-test-script.js\n\nIt'll output the scores in processes/ms, so a higher score is always better.\nThat is, the values are kHz, not Hz.\n\nYou can also export `time`, `count`, and `comparecount` to change the\nbehavior slightly.\n\nYour test script is just a plain old commonjs module, so it can include other\nthings, update require.paths, whatever setup you need to do.  Generally, it's\na good idea to do this stuff in the module itself, rather than in the\ncomparison functions, so that you can better isolate the units that you\nwant to test.\n\n## Fields\n\nExport the following fields from your benchmark script.\n\n`compare` - The hash of functions that will be compared.  The output will\nuse the object key as the title.  They're called without any arguments, in\nthe default scope.  It's assumed that you should know how to make this do\nwhatever you need it to.\n\n`time` - How long (in ms) to run the tests for.  A higher value will result\nin more accurate tests that take longer to run.  Default: `1000`\n\n`compareCount` - How many times to do the test runs.  This should be some\nfairly small number.  Tests are run multiple times in varying order to\naverage out the variation due to calling one function first, a primed\ncache, garbage collection, etc.  Higher value = more accurate, slower\ntests.  Default: `8`\n\n`countPerLap` - Especially when doing asynchronous benchmarking, you may\nwant to structure your functions so that they run a bunch of times before\ncontinuing.  In these cases, to make your scores reflect the actual number\nof processes per ms, indicate the number of runs per call in the\n\"countPerLap\" field.  Default: `1`\n\n`done` - A function that will be called with the results of the runs\nwhen they're complete.  By default, this calls a function that will\nanalyze the results a bit and write the data to `stdout`.\n\n## Asynchronous Benchmarking\n\nJust write your functions so that they take a single argument.  That\nargument is your callback.  Have fun with it.\n\nYour callback will be fired using `process.nextTick`.  This has a wee\nbit of overhead, so if you're testing something really fast, you should\nprobably construct it to run many times before calling the callback.\nCheck the `examples/nexttick-vs-settimeout.js` test for an example.\n\n# <span style=\"background:red; color:white\">WARNING!</span>\n\nStatistics are powerful tools, and in the wrong hands, can lead to a\nlot of mayhem.  Please use this tool for good, and not evil.\n","_attachments":{}}