I find declaring Local variables in FOR loops a massive slowdown. this might be due to CPU cache size or whatever technical reason, but if you are after speed, find a way to put the foor loop in a new scope and declare the vars it will use before entering. It may not be great but it is considerably faster.