projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b722771
)
startup: use `.hasOwnProperty` instead of `in`
author
Maciej Małecki
<maciej.malecki@notimplemented.org>
Sat, 18 Feb 2012 15:32:06 +0000
(16:32 +0100)
committer
Ben Noordhuis
<info@bnoordhuis.nl>
Mon, 20 Feb 2012 15:04:44 +0000
(16:04 +0100)
Benchmarks show that `.hasOwnProperty` is faster than `in` in V8. It
makes startup ~0.5 ms faster on my computer.
src/node.js
patch
|
blob
|
history
diff --git
a/src/node.js
b/src/node.js
index
e73eb18
..
2cd797f
100644
(file)
--- 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) {