mirror of
https://github.com/junegunn/fzf.git
synced 2025-09-03 05:43:49 -07:00
Improve search performance by limiting the search scope
Find the last occurrence of the last character in the pattern and perform the search algorithm only up to that point. The effectiveness of this mechanism depends a lot on the shape of the input and the pattern.
This commit is contained in:
@@ -178,12 +178,12 @@ func (chars *Chars) ToRunes() []rune {
|
||||
return runes
|
||||
}
|
||||
|
||||
func (chars *Chars) CopyRunes(dest []rune) {
|
||||
func (chars *Chars) CopyRunes(dest []rune, from int) {
|
||||
if runes := chars.optionalRunes(); runes != nil {
|
||||
copy(dest, runes)
|
||||
copy(dest, runes[from:])
|
||||
return
|
||||
}
|
||||
for idx, b := range chars.slice[:len(dest)] {
|
||||
for idx, b := range chars.slice[from:][:len(dest)] {
|
||||
dest[idx] = rune(b)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user