From 176f0bd3dfd58faf1675851cd2029e05d302f1fb Mon Sep 17 00:00:00 2001 From: Majid Arif Siddiqui Date: Thu, 14 Aug 2014 11:15:24 +0800 Subject: lib: improved forEach object performance Reviewed-by: Trevor Norris --- lib/_stream_duplex.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/_stream_duplex.js') diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index c5a741c466..75cf30d798 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -31,10 +31,12 @@ var Writable = require('_stream_writable'); util.inherits(Duplex, Readable); -Object.keys(Writable.prototype).forEach(function(method) { +var keys = Object.keys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; -}); +} function Duplex(options) { if (!(this instanceof Duplex)) -- cgit v1.2.3