mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-29 11:51:14 +00:00
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:
parent
1adb4f0a61
commit
a05d66cde6
@ -606,7 +606,7 @@ class DefaultSegment(object):
|
|||||||
index = r.get_reverse_index(base_index)
|
index = r.get_reverse_index(base_index)
|
||||||
else:
|
else:
|
||||||
index = base_index - r.get_raw_index(0)
|
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)
|
raise IndexError("index %d not in this segment" % base_index)
|
||||||
return index
|
return index
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user