magic-wormhole / magic-wormhole.rs

Rust implementation of Magic Wormhole, with new features and enhancements
European Union Public License 1.2
645 stars 72 forks source link

Feature suggestion: show bitrate in progress bar #191

Open afontenot opened 1 year ago

afontenot commented 1 year ago

Having the bitrate available is great for diagnosing performance issues at a glance, and making sure that very large transfers are proceeding as planned. I made a few modifications to the progress bar format that include showing the bitrate, but I didn't want to submit a PR for this without discussion about an acceptable format first.

I wonder if this progress bar style is worth consideration, or (alternatively) if the option to display a custom progress bar could be added as a command line option.

.template("{percent}% [{wide_bar}] {bytes} ({bytes_per_sec}) eta {eta}")
100% [###########################################] 599.21 MiB (2.56 MiB/s) eta 0s
piegamesde commented 1 year ago

Hm, your proposed design removes the time-elapsed information and the sent-bytes count. Of course, we can't cram everything into a single line so it is about priorities.

One requirement that I have though is that all items left to the progress bar are fixed size, otherwise it would wobble too much.

So, how about something like "{percent:>3}% [{wide_bar}] {bytes} ({bytes_per_sec}, {eta})"?

piegamesde commented 1 year ago

Okay I tried it out, and:

How would you like "[{bytes:>10}/{total_bytes}] [{wide_bar}] [{bytes_per_sec}, {eta}]"?

[ 51.04 MiB/2.30 GiB] [##>------------------------------------------------------] [4.72 MiB/s, 8m]

Might need more experiments with the brackets

afontenot commented 1 year ago

I don't hate that. My thinking about total size is that the sender already knows the size of the file, typically. And the receiver also knows the size of the file because it's specified right above the progress bar, i.e. Receive file 'fn' (<size> in size)? So if you're trying to buy space from somewhere it seems like an easy thing to give up.

I like having the percentage personally, but I admit it's redundant with the progress bar. Leaving it out is fine if you prefer it that way.

My one complaint about your idea is that the reserved space for {bytes} leaves a weird looking space on the left until you get into the hundreds of MiB. Maybe there's a way to always get the bytes value to format with 4 digits? So when you have hundreds of MiB, it prints something like 123.4 MiB instead of 123.45 MiB? That would solve the width problem in a cleaner fashion IMO.

piegamesde commented 1 year ago

Putting this on hold until #192 is resolved

afontenot commented 1 year ago

This could be revisited now, once we bump the indicatif version.