Might have made a change to improve performance
This commit is contained in:
@@ -169,6 +169,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
||||
// i++
|
||||
// }
|
||||
// Get the maximum index-range from the list
|
||||
end := 0
|
||||
if len(tempIndices) > 0 {
|
||||
indexToAdd := Reduce(tempIndices, func(i1 matchIndex, i2 matchIndex) matchIndex {
|
||||
r1 := i1.endIdx - i1.startIdx
|
||||
@@ -180,9 +181,14 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
||||
})
|
||||
if !overlaps(indexToAdd, indices) {
|
||||
indices, _ = unique_append(indices, indexToAdd)
|
||||
end = indexToAdd.endIdx
|
||||
}
|
||||
}
|
||||
return findAllMatchesHelper(start, str, indices, startIdx)
|
||||
if end == 0 || end == startIdx-1 { // Since we incremented startIdx earlier, we need to check against the old startIdx
|
||||
return findAllMatchesHelper(start, str, indices, startIdx)
|
||||
} else {
|
||||
return findAllMatchesHelper(start, str, indices, end)
|
||||
}
|
||||
}
|
||||
currentStates = make([]*State, len(tempStates))
|
||||
copy(currentStates, tempStates)
|
||||
|
Reference in New Issue
Block a user