diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2016-08-19 02:39:32 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2016-08-19 02:39:32 +0900 |
| commit | 37dc273148df0893053bf5cda0582a23f5c2b2d2 (patch) | |
| tree | d90f5e96fa97de429265461268b1a6db2703cb4c /src/options.go | |
| parent | f7f01d109eb05c7eae82c243b6b6d5c5951ee707 (diff) | |
| download | fzf-37dc273148df0893053bf5cda0582a23f5c2b2d2.tar.gz | |
Micro-optimizations
- Make structs smaller
- Introduce Result struct and use it to represent matched items instead of
reusing Item struct for that purpose
- Avoid unnecessary memory allocation
- Avoid growing slice from the initial capacity
- Code cleanup
Diffstat (limited to 'src/options.go')
| -rw-r--r-- | src/options.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/options.go b/src/options.go index 31ad4971..a19ff6f3 100644 --- a/src/options.go +++ b/src/options.go @@ -95,6 +95,7 @@ type criterion int const ( byMatchLen criterion = iota + byBonus byLength byBegin byEnd @@ -178,7 +179,7 @@ func defaultOptions() *Options { Delimiter: Delimiter{}, Sort: 1000, Tac: false, - Criteria: []criterion{byMatchLen, byLength}, + Criteria: []criterion{byMatchLen, byBonus, byLength}, Multi: false, Ansi: false, Mouse: true, @@ -406,7 +407,7 @@ func parseKeyChords(str string, message string) map[int]string { } func parseTiebreak(str string) []criterion { - criteria := []criterion{byMatchLen} + criteria := []criterion{byMatchLen, byBonus} hasIndex := false hasLength := false hasBegin := false |
