Daniel DeLorme wrote:
> Thank you. I also looked at find_position_in_bitfield() but I assumed 
> the compiler would be able to make those optimizations, so ended up not 
> touching it.
> 
> I notice that this patch is relative to one of the patches that I 
> submitted. But in those patches I changed the bsearch to a linear 
> search, which may not be desirable as Matz pointed out. But I'm not sure 
> it's a good idea to sacrifice performance now for the sake of a 
> hypothetical change in heap size in the future (YAGNI). Maybe a #define 
> could take care of that? e.g.
>   #ifdef FEW_HEAPS
>     order heaps by size, linear search
>   #else
>     order heaps by memory location, bsearch
>   #endif

My patch is against 1.8, which doesn't have sorted heaps.