diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-10 01:06:08 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-10 01:06:18 +0900 |
| commit | b7bb1008107fb079e68f9ebeeca699c65cc966c9 (patch) | |
| tree | 845096d80fc4ef12d8fa3cdea1ccf352623a3fc3 /src/item.go | |
| parent | aa05bf5206768965e575b6032543745c830e6eea (diff) | |
| download | fzf-b7bb1008107fb079e68f9ebeeca699c65cc966c9.tar.gz | |
Improve response time by only looking at top-N items
Diffstat (limited to 'src/item.go')
| -rw-r--r-- | src/item.go | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/item.go b/src/item.go index 4c8f13d4..60355b4c 100644 --- a/src/item.go +++ b/src/item.go @@ -104,41 +104,3 @@ func compareRanks(irank Rank, jrank Rank) bool { } return false } - -func SortMerge(partialResults [][]*Item) []*Item { - if len(partialResults) == 1 { - return partialResults[0] - } - - merged := []*Item{} - - for len(partialResults) > 0 { - minRank := Rank{0, 0, 0} - minIdx := -1 - - for idx, partialResult := range partialResults { - if len(partialResult) > 0 { - rank := partialResult[0].Rank() - if minIdx < 0 || compareRanks(rank, minRank) { - minRank = rank - minIdx = idx - } - } - } - - if minIdx >= 0 { - merged = append(merged, partialResults[minIdx][0]) - partialResults[minIdx] = partialResults[minIdx][1:] - } - - nonEmptyPartialResults := make([][]*Item, 0, len(partialResults)) - for _, partialResult := range partialResults { - if len(partialResult) > 0 { - nonEmptyPartialResults = append(nonEmptyPartialResults, partialResult) - } - } - partialResults = nonEmptyPartialResults - } - - return merged -} |
