in reply to How to traverse an array as fast as possible?

So, are you asking monks to write a Benchmark script for you? I'm not trying to be critical -- I think it's true that writing a valid test for this question would involve some subtle issues, to make sure that the right things are being tested. I'm not sure I'm up to the task (though I would predict that the "foreach (@array)" loop would do best, since it doesn't have to change the array or copy array values as it iterates).

I think it's also true that whatever difference there might be among those alternatives, it will be impressively insignificant -- it will count for nearly nothing -- when seen in the context of any real-life script that actually does something useful within the while or for loop.

  • Comment on Re: How to traverse an array as fast as possible?