Created
August 19, 2010 23:42
-
-
Save creationix/539223 to your computer and use it in GitHub Desktop.
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
From 40254b255250d5b889699eb655c8d30c00d322a3 Mon Sep 17 00:00:00 2001 | |
From: Tim Caswell <[email protected]> | |
Date: Thu, 19 Aug 2010 18:58:28 -0700 | |
Subject: [PATCH] Make process.nextTick worlds faster for large queues. | |
--- | |
src/node.js | 7 +++++-- | |
1 files changed, 5 insertions(+), 2 deletions(-) | |
diff --git a/src/node.js b/src/node.js | |
index d38f12d..82a5937 100644 | |
--- a/src/node.js | |
+++ b/src/node.js | |
@@ -47,9 +47,12 @@ process.evalcx = function () { | |
var nextTickQueue = []; | |
process._tickCallback = function () { | |
- for (var l = nextTickQueue.length; l; l--) { | |
- nextTickQueue.shift()(); | |
+ var l = nextTickQueue.length; | |
+ if (l === 0) return; | |
+ for (var i = 0; i < l; i++) { | |
+ nextTickQueue[i](); | |
} | |
+ nextTickQueue.splice(0, l); | |
}; | |
process.nextTick = function (callback) { | |
-- | |
1.7.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You think this would be any faster?