in reply to performance of huge array looping

Pop is probably more suitable than shift, but luckily for you a lhoward has written a definitive monograph on this subject.

Imo however you will need to think of a different approach to what you listed here.

HTH

Yves / DeMerphq
---
Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)