Change to overlap_size():
The ranges in the registry are sorted by start position. When calculating the overlap with a query range, a loop goes through the registered ranges and checks for overlaps between each range and the query. This change will terminate this loop when all the remaining start positions are larger than the end position of the query range. This cuts the running time for this routine by 90% in some applications that registers a large number of ranges. Tested.
Please register or sign in to comment