Commit Graph

18 Commits (e86b81bbf5c55344f4e29060b71eb1ab563296fe)

Author SHA1 Message Date
Junegunn Choi e86b81bbf5
Improve search performance by limiting the search scope
Find the last occurrence of the last character in the pattern and
perform the search algorithm only up to that point.

The effectiveness of this mechanism depends a lot on the shape of the
input and the pattern.
2 months ago
Junegunn Choi c30e486b64
Further performance improvements by removing unnecessary copies 2 months ago
Junegunn Choi 4c9cab3f8a
Fix prefix/suffix/equal matcher to trim whitespaces
- Prefix matcher will trim leading whitespaces only when the pattern
  doesn't start with a whitespace
- Suffix matcher will trim trailing whitespaces only when the pattern
  doesn't end with a whitespace
- Equal matcher will trim leading whitespaces only when the pattern
  doesn't start with a whitespace, and trim trailing whitespaces only
  when the pattern doesn't end with a whitespace

Previously, only suffix matcher would trim whitespaces unconditionally.

Fix #1894
4 years ago
Junegunn Choi 751aa1944a
Remove trailing whitespaces when using --with-nth 5 years ago
Christian Muehlhaeuser a1260feeed Code cleanup (#1640)
- Replaced time.Now().Sub() with time.Since()
- Replaced unnecessary string/byte slice conversions
- Removed obsolete return and value assignment in range loop
5 years ago
Junegunn Choi 85c1f8a9e0
Always prepend ANSI reset code before re-assembling tokens 5 years ago
Junegunn Choi ef577a6509
Preserve the original color of each token when using --with-nth with --ansi
Close #1500
5 years ago
Ryan Boehning 21b94d2de5
Make fzf pass go vet
Add String() methods to types, so they can be printed with %s. Change
some %s format specifiers to %v, when the default string representation
is good enough. In Go 1.10, `go test` triggers a parallel `go vet`. So
this also makes fzf pass `go test`.

Close #1236
Close #1219
6 years ago
Junegunn Choi af809c9661
Minor refactorings 7 years ago
Junegunn Choi 99927c7071
Modify loop conditions in checkAscii function 7 years ago
Junegunn Choi 69aa2fea68
Optimize fuzzy search performance for ASCII strings 7 years ago
Junegunn Choi c9f16b6430
Avoid unconditionally storsing input as runes
When --with-nth is used, fzf used to preprocess each line and store the
result as rune array, which was wasteful if the line only contains ascii
characters.
7 years ago
Junegunn Choi 5e72709613
Speed up initial scanning with bitwise AND operation 7 years ago
Junegunn Choi 9e85cba0d0
Reduce memory footprint of Item struct 7 years ago
Junegunn Choi 04492bab10
Use unicode.IsSpace to cover more whitespace characters 8 years ago
Junegunn Choi d9c8a9a880
[perf] Remove memory copy when using string delimiter 8 years ago
Junegunn Choi ddc7bb9064
[perf] Optimize AWK-style tokenizer for --nth
Approx. 50% less memory footprint and 40% improvement in query time
8 years ago
Junegunn Choi 1d4057c209
[perf] Avoid allocating rune array for ascii string
In the best case (all ascii), this reduces the memory footprint by 60%
and the response time by 15% to 20%. In the worst case (every line has
non-ascii characters), 3 to 4% overhead is observed.
8 years ago