summaryrefslogtreecommitdiff
path: root/src/algo
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-07-16 23:31:19 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-07-16 23:34:32 +0900
commit9e85cba0d06025983a1a747bfc06c9955388d9c0 (patch)
tree8fe8dc1fd62ad3ecfbfd02e440fac6cfedcd313c /src/algo
parent4b59ced08f1d417530a25af8fe13aa5d40579220 (diff)
downloadfzf-9e85cba0d06025983a1a747bfc06c9955388d9c0.tar.gz
Reduce memory footprint of Item struct
Diffstat (limited to 'src/algo')
-rw-r--r--src/algo/algo.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/algo/algo.go b/src/algo/algo.go
index ac6c66d5..c4930c11 100644
--- a/src/algo/algo.go
+++ b/src/algo/algo.go
@@ -283,8 +283,9 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input util.C
// Phase 1. Check if there's a match and calculate bonus for each point
pidx, lastIdx, prevClass := 0, 0, charNonWord
+ input.CopyRunes(T)
for idx := 0; idx < N; idx++ {
- char := input.Get(idx)
+ char := T[idx]
var class charClass
if char <= unicode.MaxASCII {
class = charClassOfAscii(char)
@@ -389,7 +390,7 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input util.C
if i == 0 {
fmt.Print(" ")
for j := int(F[i]); j <= lastIdx; j++ {
- fmt.Printf(" " + string(input.Get(j)) + " ")
+ fmt.Printf(" " + string(T[j]) + " ")
}
fmt.Println()
}