fryewiles.PNGI’m familiar with the benefits of removing the array length calculation from your loop by pre-calculating the array length. I’m also familiar the benefits of using indexed arrays instead of associative arrays.

However, I didn’t know that using pre-increment rather than post in your counter calculation is faster.

From blog:

“Furthermore, if we switch from the post-increment operator, to the pre-increment operator, we should also see some time improvements. The difference is that in using the post-increment operator (a++), a copy of the variable is made, the original value is incremented, and then that copy is returned. With pre-increment operator (++a), the value is incremented and then returned, cutting the process down one less step. “

http://tinyurl.com/2rsrp2

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]


Comments

  1. 1
    Julian
    March 17th, 2008 at 10:45 am

    Michael and Cris.. you know whats coming with this post!! ;)

Leave a Comment

You must be logged in to post a comment.

blank