From c3a9733ac14aa0ebf06cc4d9e3ababe8c9be6220 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Maciej=20Ma=C5=82ecki?= Date: Sat, 18 Feb 2012 16:32:06 +0100 Subject: [PATCH] startup: use `.hasOwnProperty` instead of `in` Benchmarks show that `.hasOwnProperty` is faster than `in` in V8. It makes startup ~0.5 ms faster on my computer. --- src/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index e73eb18..2cd797f 100644 --- a/src/node.js +++ b/src/node.js @@ -491,7 +491,7 @@ } NativeModule.exists = function(id) { - return (id in NativeModule._source); + return NativeModule._source.hasOwnProperty(id); } NativeModule.getSource = function(id) { -- 2.7.4