performance optimizations in queue