Skip to content

Instantly share code, notes, and snippets.

@chakrit
Created July 5, 2012 08:32
Show Gist options
  • Save chakrit/3052285 to your computer and use it in GitHub Desktop.
Save chakrit/3052285 to your computer and use it in GitHub Desktop.
var i = 0;
for (; i < 10000000; i++)
process.nextTick(function() { });
var i = 0;
for (; i < 10000000; i++)
{ var x = i = i; }
var i = 0;
for (; i < 10000000; i++)
(function() { })();
var i = 0
, func = function() { };
for (; i < 10000000; i++)
(func)();
@chakrit
Copy link
Author

chakrit commented Jul 5, 2012

$ time node a.js && time node b.js && time node c.js && time node a.js && time node b.js && time node c.js
node a.js 3.87s user 0.68s system 101% cpu 4.477 total
node b.js 0.05s user 0.01s system 95% cpu 0.060 total
node c.js 0.17s user 0.01s system 99% cpu 0.176 total
node a.js 3.91s user 0.67s system 103% cpu 4.450 total
node b.js 0.05s user 0.01s system 98% cpu 0.057 total
node c.js 0.17s user 0.01s system 99% cpu 0.176 total

@chakrit
Copy link
Author

chakrit commented Jul 5, 2012

$ time node d.js && time node d.js && time node d.js
node d.js 0.11s user 0.01s system 99% cpu 0.123 total
node d.js 0.11s user 0.01s system 98% cpu 0.119 total
node d.js 0.11s user 0.01s system 99% cpu 0.119 total

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment