hobeau Posted December 27, 2008 Share Posted December 27, 2008 Here's an article I wrote awhile back about javascript loop performance when iterating through the DOM. http://www.solutionbot.com/2008/05/14/javascript-loop-performance/ I thought it was interesting to see the differences between IE and all the rest. IE has a severely slow javascript engine and it does not compensate for issues such as this as do other browsers. Keeping your .length function outside of your loops isn't just a 'best practice', it can be the difference between a high performance DHTML app or a sluggish one. Just thought I'd share. Link to comment https://forums.phpfreaks.com/topic/138518-javascript-loop-performance/ Share on other sites More sharing options...
Adam Posted December 27, 2008 Share Posted December 27, 2008 Interesting. I wasn't even aware it was slower. IE7 results are shocking! Do you have the script available for people to test on their own machines? A Link to comment https://forums.phpfreaks.com/topic/138518-javascript-loop-performance/#findComment-724442 Share on other sites More sharing options...
hobeau Posted December 27, 2008 Author Share Posted December 27, 2008 There is a link on the post but you can get it here http://www.solutionbot.com/wp-content/uploads/2008/05/test.htm Link to comment https://forums.phpfreaks.com/topic/138518-javascript-loop-performance/#findComment-724483 Share on other sites More sharing options...
Adam Posted December 27, 2008 Share Posted December 27, 2008 Ah okay.. Results from IE8 and FF3 on my machine: IE8 Test 1: 2230 Test 2: 71 FF3 Test 1: 50 Test 2: 67 Link to comment https://forums.phpfreaks.com/topic/138518-javascript-loop-performance/#findComment-724491 Share on other sites More sharing options...
Philip Posted December 27, 2008 Share Posted December 27, 2008 Wow! That is insane, the difference is just unbelievable IE7 Test 1: 25,516 Test 2: 61 FF3 Test 1: 55 Test 2: 28 Chrome Test 1: 14 Test 2: 6 Link to comment https://forums.phpfreaks.com/topic/138518-javascript-loop-performance/#findComment-724593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.