summaryrefslogtreecommitdiff
path: root/lib/tls.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/tls.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/tls.js')
-rw-r--r--lib/tls.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tls.js b/lib/tls.js
index 9e1b928ee8..3ae7a8f58b 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -3,6 +3,7 @@
const net = require('net');
const url = require('url');
const util = require('util');
+const binding = process.binding('crypto');
// Allow {CLIENT_RENEG_LIMIT} client-initiated session renegotiations
// every {CLIENT_RENEG_WINDOW} seconds. An error event is emitted if more
@@ -35,7 +36,7 @@ exports.DEFAULT_CIPHERS = [
exports.DEFAULT_ECDH_CURVE = 'prime256v1';
exports.getCiphers = function() {
- const names = process.binding('crypto').getSSLCiphers();
+ const names = binding.getSSLCiphers();
// Drop all-caps names in favor of their lowercase aliases,
var ctx = {};
names.forEach(function(name) {