- From: Domenic Denicola <domenic@domenicdenicola.com>
- Date: Mon, 18 Nov 2013 18:19:11 +0000
- To: Boris Zbarsky <bzbarsky@MIT.EDU>, "public-script-coord@w3.org" <public-script-coord@w3.org>
From: Boris Zbarsky <bzbarsky@MIT.EDU> > But maybe I misunderstand the performance cost you're worrying about? Well, I'm not sure, so let me restate it just in case. Let's say I pass a sequence containing 1000 numbers to such a function. Your proposed behavior is, from what I understand, ```js function frobEachElement(sequence) { var array = []; for (var el of sequence) { array.push(Number(el)); } array.forEach(frob); } ``` So you do a total of 2000 iterations. Whereas the "idiomatic" way would be ```js function frobEachElement(sequence) { for (var el of sequence) { frob(Number(el)); } } ``` which only does 1000 iterations. Thoughts?
Received on Monday, 18 November 2013 18:20:01 UTC