Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created January 30, 2013 17:53
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 isaacs/4675142 to your computer and use it in GitHub Desktop.
Save isaacs/4675142 to your computer and use it in GitHub Desktop.
diff --git a/src/node.js b/src/node.js
index 9fc68e4..58ab066 100644
--- a/src/node.js
+++ b/src/node.js
@@ -454,10 +454,10 @@
var tock = { callback: callback };
if (process.domain) tock.domain = process.domain;
- nextTickQueue.push(tock);
- if (nextTickQueue.length) {
+ if (nextTickQueue.length === 0) {
process._needTickCallback();
}
+ nextTickQueue.push(tock);
};
};
@trevnorris
Copy link

if I remember correctly, it's lest costly for v8 to do:

var tock = {
  callback: callback,
  domain: process.domain || false
};

Morphing an object after it's created should be avoided when possible.

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