replace uses of `heapq` with more efficient operations
Authored by: mgood 2007-03-27
Parent: [r5147]
Child: [r5149]