authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-27 11:21:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-27 20:56:49-07:00
logeea7e5e554ff12b4b72a8aa8877d059e7c055bc3
tree94e29b7bdbab1f16178b4c3dc7e35f5c7217271c
parenta5e4fe5487d2ac8d8bafceb6edba8ae2d87aa86c

std.Progress: adjust the timings a little bit

Slightly slower refresh rate. It's still updating very quickly. Lower the initial delay so that CLI applications feel more responsive. Even though the application is doing work for the full 500ms until something is displayed on the screen, it feels nicer to get the progress earlier.

1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/Progress.zig+2-2
...@@ -59,9 +59,9 @@ pub const Options = struct {...@@ -59,9 +59,9 @@ pub const Options = struct {
59 /// Must be at least 200 bytes.59 /// Must be at least 200 bytes.
60 draw_buffer: []u8 = &default_draw_buffer,60 draw_buffer: []u8 = &default_draw_buffer,
61 /// How many nanoseconds between writing updates to the terminal.61 /// How many nanoseconds between writing updates to the terminal.
62 refresh_rate_ns: u64 = 60 * std.time.ns_per_ms,62 refresh_rate_ns: u64 = 80 * std.time.ns_per_ms,
63 /// How many nanoseconds to keep the output hidden63 /// How many nanoseconds to keep the output hidden
64 initial_delay_ns: u64 = 500 * std.time.ns_per_ms,64 initial_delay_ns: u64 = 200 * std.time.ns_per_ms,
65 /// If provided, causes the progress item to have a denominator.65 /// If provided, causes the progress item to have a denominator.
66 /// 0 means unknown.66 /// 0 means unknown.
67 estimated_total_items: usize = 0,67 estimated_total_items: usize = 0,