1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-02-02 20:46:57 +00:00
restic/internal/ui
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
..
backup ui/backup: Fix percent and eta in backup progress 2023-01-21 13:25:08 -07:00
progress progress: extract progress updating into Updater struct 2023-01-14 01:13:08 +01:00
signals add go:build headers everywhere 2022-03-28 22:23:47 +02:00
table
termstatus ui/termstatus: Optimize Truncate 2023-04-14 11:13:39 +02:00
format.go ui: Fix FormatBytes at exactly 1024 time a unit 2022-10-31 18:39:28 +01:00
format_test.go ui: Fix FormatBytes at exactly 1024 time a unit 2022-10-31 18:39:28 +01:00
message.go
stdio_wrapper.go
stdio_wrapper_test.go