This is an in-place heapsort that I am trying to optimize for the sorting benchmark here: http://scratch.mit.edu/projects/43755392/ Before this, I had a version that stored the heap in another list that was much faster for some reason, but after making it in-place, it became much slower for some reason.