repalce sequential search with binary search in all_bb