Optimized performance of PriorityQueue