From 9e85cba0d06025983a1a747bfc06c9955388d9c0 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 16 Jul 2017 23:31:19 +0900 Subject: Reduce memory footprint of Item struct --- src/algo/algo.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/algo') 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() } -- cgit v1.2.3