restic/internal/ui/termstatus
greatroar 49e32f3f8a ui/termstatus: Optimize Truncate
x/text/width.LookupRune has to re-encode its argument as UTF-8,
while LookupString operates on the UTF-8 directly.
The uint casts get rid of a bounds check.

Benchmark results, with b.ResetTimer introduced first:

name               old time/op  new time/op  delta
TruncateASCII-8    69.7ns ± 1%  55.2ns ± 1%  -20.90%  (p=0.000 n=20+18)
TruncateUnicode-8   350ns ± 1%   171ns ± 1%  -51.05%  (p=0.000 n=20+19)
2023-04-14 11:13:39 +02:00
..
background_linux_test.go Add more error handling 2021-01-30 20:19:47 +01:00
background_linux.go Fix IsProcessBackground on Linux with stdin redirection 2020-10-13 13:12:02 +02:00
background.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
status_test.go ui/termstatus: Optimize Truncate 2023-04-14 11:13:39 +02:00
status.go ui/termstatus: Optimize Truncate 2023-04-14 11:13:39 +02:00
terminal_posix.go Rework termstatus 2018-05-07 21:40:07 +02:00
terminal_unix.go switch to golang.org/x/term 2022-03-28 22:24:15 +02:00
terminal_windows_test.go Add test to mintty pipe detection 2021-04-11 20:02:09 +02:00
terminal_windows.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00