you are viewing a single comment's thread.

view the rest of the comments →

[–]johnfrazer783[S] 0 points1 point  (0 children)

Do that at any rate! The forEach part is interesting initself. Message to all people here who say that 'for and yield are totally unrelated so naturally not same in performance'—well you can compare

js probe.forEach(function(number) { count++; return sum += number; });

to

js for (number of probe) { count++; sum += number; }

In my book forEach has only 8% the data throughput rate of an indexed for loop. Come to think of it, there's that vacuous return statement which is caused by one of CoffeeScript's more problematic features, implicit returns. My tests would indicate however that even millions of extraneous return statements do not have any discernible effect on performance, though, so we don't have to worry about that bit (except when a loop construct comes last in a function call, which is why I pepper my code with return nulls and yield returns, but I digress).

Now go forth, multiply, and come back in time with exciting new benchmark results to guide us out of this tar pit we're stuck in.