mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-10 17:51:58 -07:00
Performance tuning - eager rune array conversion
> wc -l /tmp/list2 2594098 /tmp/list2 > time cat /tmp/list2 | fzf-0.10.1-darwin_amd64 -fqwerty > /dev/null real 0m5.418s user 0m10.990s sys 0m1.302s > time cat /tmp/list2 | fzf-head -fqwerty > /dev/null real 0m4.862s user 0m6.619s sys 0m0.982s
This commit is contained in:
@@ -441,10 +441,10 @@ func (t *Terminal) printHeader() {
|
||||
if line >= max {
|
||||
continue
|
||||
}
|
||||
trimmed, colors, newState := extractColor(&lineStr, state)
|
||||
trimmed, colors, newState := extractColor(lineStr, state)
|
||||
state = newState
|
||||
item := &Item{
|
||||
text: trimmed,
|
||||
text: []rune(trimmed),
|
||||
index: 0,
|
||||
colors: colors,
|
||||
rank: Rank{0, 0, 0}}
|
||||
@@ -537,7 +537,7 @@ func (t *Terminal) printHighlighted(item *Item, bold bool, col1 int, col2 int, c
|
||||
}
|
||||
|
||||
// Overflow
|
||||
text := []rune(*item.text)
|
||||
text := item.text
|
||||
offsets := item.colorOffsets(col2, bold, current)
|
||||
maxWidth := C.MaxX() - 3 - t.marginInt[1] - t.marginInt[3]
|
||||
fullWidth := displayWidth(text)
|
||||
|
Reference in New Issue
Block a user