in reply to Which way is faster?

One important point is to gauge the time complexity of the algorithm. This is the most important consideration when deciding how the application will scale.

An example is Ovid's question 1 in (OT) Interview questions -- your response?. Here, a 'solution' to a matching problem is presented in code, but is order n2.

Especially where huge databases are involved, getting the algorithm right far outweighs shaving CPU cycles off a calculation. In order to achieve this, it becomes important to think about precisely how an application will scale. If we double the number of customers, how will this affect the run time?