mirror of
https://github.com/charmbracelet/gum.git
synced 2024-10-26 15:20:05 +03:00
perf: improve filter fuzzy by pre-allocating slice
This commit is contained in:
parent
89f2928571
commit
84f3096665
@ -135,10 +135,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func matchAll(options []string) []fuzzy.Match {
|
func matchAll(options []string) []fuzzy.Match {
|
||||||
//nolint:prealloc
|
var matches = make([]fuzzy.Match, len(options))
|
||||||
var matches []fuzzy.Match
|
for i, option := range options {
|
||||||
for _, option := range options {
|
matches[i] = fuzzy.Match{Str: option}
|
||||||
matches = append(matches, fuzzy.Match{Str: option})
|
|
||||||
}
|
}
|
||||||
return matches
|
return matches
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user