fireworks.js icon indicating copy to clipboard operation
fireworks.js copied to clipboard

Array.forEach is much slower than for

Open ROMB opened this issue 11 years ago • 7 comments

This is really faster in about 40%

ROMB avatar Apr 30 '13 11:04 ROMB

In fact, it is 40% less CPU time, that is, productivity increased approximately 6 times.

ROMB avatar Apr 30 '13 11:04 ROMB

Fixed some typo

ROMB avatar Apr 30 '13 12:04 ROMB

40% faster !!! defintitly interesting, how did you get this number ?

jeromeetienne avatar Apr 30 '13 14:04 jeromeetienne

CPU profiling on my own project. Fireworks CPU usage on render changed from 48% to 8%

ROMB avatar Apr 30 '13 21:04 ROMB

Also found some tests. http://jsperf.com/foreach-speed-test

ROMB avatar Apr 30 '13 22:04 ROMB

Updated... I'm bein wrong about for .. in, because i'm writing on coffescript, and it replaces for in with for loop. Updated test to compare forEach, for .. in and for. http://jsperf.com/foreach-speed-test/3

ROMB avatar Apr 30 '13 22:04 ROMB

up

ROMB avatar Sep 06 '13 05:09 ROMB