[RESOLVED] array_shift() vs. array_reverse() + array_pop()
I've read the benchmarking tests conducted on large iterations of data removal from an array using either array_shift() or array_reverse() + array_pop(). array_shift() fails hugely, obviously for having to re-index the entire array.
My question is though; on smaller tests, involving an array with no more than 5 - 10 elements it shouldn't make a significant difference. But how much processing overhead is associated with using array_shift()? What I mean is, if a page using array_shift() on a 5 - 10 element array, is called several times a second, will that still cause significant lag?
Re: array_shift() vs. array_reverse() + array_pop()
you will probably not notice the difference. my thinking is that you shouldn't over optimize anything -- write code in the clearest way possible, and if this becomes the bottleneck, optimize it.