1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-21 12:16:54 +02:00
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
..
2024-04-18 10:10:30 +02:00
2024-04-12 08:33:47 +02:00
2024-04-18 10:10:30 +02:00
2024-06-23 12:33:16 +02:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2024-04-12 08:33:47 +02:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2023-04-30 13:19:53 +10:00
2023-04-30 13:19:53 +10:00
2024-04-18 10:10:30 +02:00