jesseduffield.lazygit/pkg/utils
Stefan Haller 26132cf5bd Use utils.StringWidth to optimize rendering performance
runewidth.StringWidth is an expensive call, even if the input string is pure
ASCII. Improve this by providing a wrapper that short-circuits the call to len
if the input is ASCII.

Benchmark results show that for non-ASCII strings it makes no noticable
difference, but for ASCII strings it provides a more than 200x speedup.

BenchmarkStringWidthAsciiOriginal-10            718135       1637 ns/op
BenchmarkStringWidthAsciiOptimized-10        159197538          7.545 ns/op
BenchmarkStringWidthNonAsciiOriginal-10         486290       2391 ns/op
BenchmarkStringWidthNonAsciiOptimized-10        502286       2383 ns/op
2024-06-23 13:10:48 +02:00
..
yaml_utils Remove redundant variable dedeclarations 2024-05-19 16:38:21 +10:00
color.go feat: accept named colors for gui.authorColors 2022-05-04 19:03:00 +09:00
color_test.go update linters 2022-03-19 12:12:57 +11:00
date.go Use 'M' for months in branches panel 2023-07-30 18:35:22 +10:00
date_test.go Fix unit tests 2023-07-30 18:35:23 +10:00
dummies.go Add AppState to common.Common 2023-09-04 17:48:39 +02:00
errors.go
formatting.go Use utils.StringWidth to optimize rendering performance 2024-06-23 13:10:48 +02:00
formatting_test.go Use utils.StringWidth to optimize rendering performance 2024-06-23 13:10:48 +02:00
history_buffer.go chore: use errors.New to replace fmt.Errorf with no parameters. 2024-04-24 16:21:34 +08:00
history_buffer_test.go Add search history 2023-09-20 08:35:41 +03:00
io.go refactor 2021-06-02 20:33:52 +10:00
lines.go Implement ScanLinesAndTruncateWhenLongerThanBuffer 2024-05-15 13:27:01 +02:00
lines_test.go Implement ScanLinesAndTruncateWhenLongerThanBuffer 2024-05-15 13:27:01 +02:00
once_writer.go add deadlock mutex package 2022-08-07 11:16:14 +10:00
once_writer_test.go add deadlock mutex package 2022-08-07 11:16:14 +10:00
rebase_todo.go chore: use errors.New to replace fmt.Errorf with no parameters. 2024-04-24 16:21:34 +08:00
rebase_todo_test.go Switch git-todo-parser from fsmiamoto original repo to stefanhaller's fork 2024-04-22 20:59:15 +02:00
regexp.go add FindNamedMatches function in utils 2021-12-26 16:48:23 +11:00
regexp_test.go add FindNamedMatches function in utils 2021-12-26 16:48:23 +11:00
search.go Rename FuzzySearch to FilterStrings 2024-03-17 11:55:30 +01:00
search_test.go Rename FuzzySearch to FilterStrings 2024-03-17 11:55:30 +01:00
slice.go Standardise on using lo for slice functions 2023-07-30 18:51:23 +10:00
slice_test.go Remove redundant variable dedeclarations 2024-05-19 16:38:21 +10:00
string_stack.go start refactoring gui 2022-03-17 19:13:40 +11:00
template.go fix: fix ReplacePlaceholderString 2023-01-18 20:56:22 +09:00
template_test.go fix: fix ReplacePlaceholderString 2023-01-18 20:56:22 +09:00
thread_safe_map.go use thread safe map 2022-10-02 20:57:44 -07:00
thread_safe_map_test.go use thread safe map 2022-10-02 20:57:44 -07:00
utils.go Replace min/max helpers with built-in min/max 2024-04-07 23:24:10 +08:00
utils_test.go Replace min/max helpers with built-in min/max 2024-04-07 23:24:10 +08:00