Profiling speedup #3: reduce number of function calls inside get_index_from_base_index because it gets called *a lot* in loops

This commit is contained in:
Rob McMullen 2017-10-05 23:18:41 -07:00
parent 1adb4f0a61
commit a05d66cde6

View File

@ -606,7 +606,7 @@ class DefaultSegment(object):
index = r.get_reverse_index(base_index)
else:
index = base_index - r.get_raw_index(0)
if not self.is_valid_index(index):
if index < 0 or index >= self.rawdata.data_length:
raise IndexError("index %d not in this segment" % base_index)
return index