Fix Issue 12245 - BinaryHeap expensive in -debug

https://d.puremagic.com/issues/show_bug.cgi?id=12245
Merge pull request #1976 from Poita/bug12245

Fix Issue 12245 - BinaryHeap expensive in -debug