Last active
August 29, 2015 14:13
-
-
Save fengmk2/9b6a76685d50e8a22b6b to your computer and use it in GitHub Desktop.
http-errors benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var createError = require('http-errors'); | |
| var start = Date.now(); | |
| var count = 100000; | |
| for (var i = 0; i < count; i++) { | |
| createError(401, 'Please login to view this page.', { | |
| stat: 'foo error', | |
| errors: [ | |
| { | |
| foo: 'bar', | |
| }, | |
| { | |
| foo2: 'bar2', | |
| } | |
| ] | |
| }); | |
| } | |
| var use = Date.now() - start; | |
| console.log('http-errors: %d times use %d ms, qps: %d', count, use, count / use * 1000); | |
| // $ node --harmony bench.js | |
| // http-errors: 100000 times use 2169 ms, qps: 46104.19548178884 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment