1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-03 22:59:46 +02:00
Files
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
..
2022-03-19 12:12:57 +11:00
2023-07-30 18:35:23 +10:00
2023-07-30 18:35:22 +10:00
2023-09-04 17:48:39 +02:00
2023-09-20 08:35:41 +03:00
2021-06-02 20:33:52 +10:00
2022-08-07 11:16:14 +10:00
2022-08-07 11:16:14 +10:00
2024-03-17 11:55:30 +01:00
2022-03-17 19:13:40 +11:00
2023-01-18 20:56:22 +09:00
2022-10-02 20:57:44 -07:00
2022-10-02 20:57:44 -07:00