npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-benchmark

v0.0.1

Published

a benchmark utils for node.js

Downloads

2

Readme

node-benchmark

a benchmark util for Node.js.
You can use it test every function, get a report like this:

Benchmark test at Fri Sep 07 2012 01:53:53 GMT+0800 (CST):
getAsync(123, cb)
Number of totaol request: 1000, CONCURRENT users: 10
Time taken for tests: 0.398   seconds
Complete requests:    1000   
Failed requests:      0      
Requests per second:  2512.56 [#/sec]
Time per request:     2.81    [ms]   
Max response time:    87[ms] Response time distribute:
Response time | Num | Proportion
0 ~ 5         | 940 | 94.00%    
5 ~ 10        | 40  | 4.00%     
10 ~ 20       | 10  | 1.00%     
20 ~ 30       | 0   | 0.00%     
30 ~ 40       | 0   | 0.00%     
40 ~ 50       | 4   | 0.40%     
50 ~ 80       | 4   | 0.40%     
80 ~ 100      | 2   | 0.20%     
100 ~ 200     | 0   | 0.00%     
200 ~ 300     | 0   | 0.00%     
300 ~ 500     | 0   | 0.00%     
500 ~ 1000    | 0   | 0.00%     
1000 ~ 2000   | 0   | 0.00%     
2000 ~ 3000   | 0   | 0.00%     
 > 3000       | 0   | 0.00%  

Usage:

  • Use nbm:
 nbm [options]
example:./benchmark -c conf.js -l out.log -t md

Options:
  -c, --config   input config file path, array of inputs       [required]
  -l, --log      -l FILE, LOG to FILE.                       
  -t, --logType  log type, could be markdown/md, default text
  • In conf.js, must exports a array of options. These options are for lib/benchmark:
var rewire = require('rewire');
var methods = rewire('./example/methods');
/**
 * {Number}   requests      total requests number
 * {Number}   concurrent    concurrent user number
 * {String}   type          which type of method, `sync`, `async`, `http`, `hsf`
 * {Function} method        which method want to be test
 * {Array}    args          invoke arguments
 * {All}      result        expect invoke result
 * {String}   description   describe this method, just for dispaly and record to the log file
 * @type {Array}
 */
module.exports = [{
  requests: 10000,
  concurrent: 500,
  type: 'async',
  method: methods.getAsync,
  args: [123],
  result: 123,
  description: 'getAsync(123, cb)'  
}, {
  requests: 10000,
  concurrent: 500,
  type: 'async',
  method: methods.__get__('_privateGet'),
  args: [123],
  result: 123,
  description: '_privateGet(123, cb)'  
}];

Just like upside, use rewire can get the private method to be tested.

Install

npm install -g node-benchmark

Todo

  • more test
  • sync, http, hsf method support
  • api

License

MIT