summaryrefslogtreecommitdiff
path: root/lib/cluster.js
diff options
context:
space:
mode:
authorBrendan Ashworth <brendan.ashworth@me.com>2015-04-07 01:37:13 -0700
committerBrendan Ashworth <brendan.ashworth@me.com>2015-04-09 10:51:19 -0700
commit1219e7466cddf705d340ef566f6c1958f75735bb (patch)
tree51846e8aaf932abc1b940271bcad0858f2b18fd3 /lib/cluster.js
parent69bc1382b7b0a1271a5f344be7574c55addc99e8 (diff)
downloadandroid-node-v8-1219e7466cddf705d340ef566f6c1958f75735bb.tar.gz
android-node-v8-1219e7466cddf705d340ef566f6c1958f75735bb.tar.bz2
android-node-v8-1219e7466cddf705d340ef566f6c1958f75735bb.zip
lib: reduce process.binding() calls
This commit better handles calls to process.binding() in lib/ by no longer lazy loading the bindings (the load times themselves are rather miniscule compared to the load time of V8) and never reloading the bindings (which is 172 times slower than referencing a variable with the same value). PR-URL: https://github.com/iojs/io.js/pull/1367 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/cluster.js')
-rw-r--r--lib/cluster.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/cluster.js b/lib/cluster.js
index 14d0bc69b3..08230ad4aa 100644
--- a/lib/cluster.js
+++ b/lib/cluster.js
@@ -9,6 +9,8 @@ const util = require('util');
const SCHED_NONE = 1;
const SCHED_RR = 2;
+const uv = process.binding('uv');
+
const cluster = new EventEmitter;
module.exports = cluster;
cluster.Worker = Worker;
@@ -142,7 +144,7 @@ RoundRobinHandle.prototype.add = function(worker, send) {
// Hack: translate 'EADDRINUSE' error string back to numeric error code.
// It works but ideally we'd have some backchannel between the net and
// cluster modules for stuff like this.
- var errno = process.binding('uv')['UV_' + err.errno];
+ var errno = uv['UV_' + err.errno];
send(errno, null);
});
};