Skip to content

Instantly share code, notes, and snippets.

@seishun
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seishun/10127786 to your computer and use it in GitHub Desktop.
Save seishun/10127786 to your computer and use it in GitHub Desktop.
var buf = require('crypto').randomBytes(1024);
var zlib = require('zlib');
function doNothing() {}
var count = process.argv[2] || 1;
for (var i = 0; i < count; i++) {
zlib.deflate(buf, doNothing);
}
var buf = require('crypto').randomBytes(1024);
var zlib = require('zlib');
var count = process.argv[2] || 1;
for (var i = 0; i < count; i++) {
var inf = zlib.deflateSync(buf);
}
drkoljan@ns396737:~$ time node/node test-zlib/sync.js 1
real 0m0.063s
user 0m0.056s
sys 0m0.004s
drkoljan@ns396737:~$ time node/node test-zlib/async.js 1
real 0m0.066s
user 0m0.048s
sys 0m0.016s
drkoljan@ns396737:~$ time node/node test-zlib/sync.js 100
real 0m0.078s
user 0m0.064s
sys 0m0.012s
drkoljan@ns396737:~$ time node/node test-zlib/async.js 100
real 0m0.101s
user 0m0.112s
sys 0m0.008s
drkoljan@ns396737:~$ time node/node test-zlib/sync.js 10000
real 0m0.911s
user 0m0.856s
sys 0m0.072s
drkoljan@ns396737:~$ time node/node test-zlib/async.js 10000
real 0m1.751s
user 0m2.032s
sys 0m0.336s
drkoljan@ns396737:~$ time node/node test-zlib/sync.js 100000
real 0m9.147s
user 0m8.816s
sys 0m0.364s
drkoljan@ns396737:~$ time node/node test-zlib/async.js 100000
real 0m18.142s
user 0m20.964s
sys 0m3.332s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment