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-06-23 13:10:48 +02:00
2023-04-30 13:19:52 +10:00
2023-04-30 13:19:52 +10:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2024-06-23 12:53:15 +02:00
2024-01-19 10:50:49 +11:00
2024-03-11 09:18:40 +01: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
2024-05-19 07:06:18 +02:00
2024-04-18 10:10:30 +02:00
2024-05-19 07:06:18 +02:00
2024-06-23 12:40:31 +02:00
2024-05-19 16:38:21 +10:00
2024-06-23 12:43:34 +02:00
2023-07-03 12:54:13 +10:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2024-01-28 08:33:13 +11:00
2024-01-19 10:50:49 +11:00
2024-04-18 10:10:30 +02:00
2024-06-23 11:54:21 +02:00
2024-03-09 07:55:22 +01:00
2024-06-23 12:53:15 +02:00
2024-01-28 08:33:13 +11:00
2024-01-28 08:33:13 +11:00
2024-01-15 20:08:11 +11:00
2024-01-28 08:33:13 +11:00
2024-04-18 10:10:30 +02:00
2024-01-19 10:47:21 +11:00
2024-04-12 08:33:47 +02:00
2024-06-23 12:53:15 +02:00
2024-04-18 10:10:30 +02:00
2024-06-23 13:10:48 +02:00
2023-08-21 08:10:28 +02:00
2024-04-07 23:24:10 +08:00
2023-07-03 12:54:13 +10:00
2024-01-19 10:50:49 +11:00
2024-01-19 10:50:49 +11:00
2024-01-19 10:50:49 +11:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2024-06-03 13:02:46 +02:00
2024-04-18 10:10:30 +02:00
2024-04-18 10:10:30 +02:00
2024-05-19 07:06:18 +02:00
2024-02-16 13:06:24 +01:00
2024-01-23 13:03:37 +11:00
2024-06-01 08:12:45 +02:00
2024-04-12 08:31:40 +02:00
2024-04-18 10:10:30 +02:00
2022-04-02 17:04:42 +11:00
2024-04-28 09:44:59 +02:00
2023-04-30 13:19:53 +10:00
2024-04-18 10:10:30 +02:00
2024-01-23 13:03:37 +11:00
2024-04-18 10:10:30 +02:00