Optimization after replacing SplPriorityQueue by an array