-
-
Notifications
You must be signed in to change notification settings - Fork 589
Adding TransferSpeedColumn configuration to display bits/bytes + binary/decimal prefixes #904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding TransferSpeedColumn configuration to display bits/bytes + binary/decimal prefixes #904
Conversation
@patriksvensson @phil-scott-78 Could I kindly ask for your thoughts and feedback on these changes whenever you have some time to take a look? I'd be more than happy to discuss the changes in further details, and I would be glad to know if there is anything I can do to help get these changes included. Thank you! |
@microsoft-github-policy-service agree |
Hey @tpill90, looks like an interesting, well drafted PR - are you still around to help me get this reviewed/merged? (assuming I might need your help, although perhaps we get lucky with a straight merge...). I assume you'd like this for https://github.com/tpill90/steam-lancache-prefill ? (which looks awesome btw)? Update |
I like this PR @tpill90 and have started reviewing it. Solid code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial review feedback and suggested changes here: https://github.com/tpill90/spectre.console/pull/1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brain dump of my review comments below.
I used to dread this kind of thing when contributing @tpill90, but the review is a sign that I feel your contribution is worth spending time on, and getting it over the line.
I'm not 'the boss' and you don't need to silently accept everything I say in this, rather, we are peers, your coding skills are probably superior to mine, and we hash out the details until we are both happy. Truly excellent library code is what we want. Feel free to disagree with anything I say, but provide an explanation when you do, so I can consider the merits.
Your fork/branch is really old, I'd suggest you rebase (as I can't actually compile it - I've been working off a recent main fork with your commits cherry-picked).
Noted your comment about testing TransferSpeedColumn
- I'll need to give it some thought.
src/Spectre.Console/Live/Progress/Columns/TransferSpeedColumn.cs
Outdated
Show resolved
Hide resolved
test/Spectre.Console.Tests/Unit/Live/Progress/DownloadedColumnTests.cs
Outdated
Show resolved
Hide resolved
test/Spectre.Console.Tests/Unit/Live/Progress/DownloadedColumnTests.cs
Outdated
Show resolved
Hide resolved
…both bytes/bits, as well as using binary/decimal prefix definitions.
There is no rush/pressure @tpill90 with this. Just to say I will be happy to progress the PR as and when you are ready. It won't be one that languishes. In the meantime, be well 👏. |
Hey Frank, I apologize for not getting a chance to look at it yet. I'm going to try to get to it today. Thanks for your help on this |
I'll look at your comments/changes soon @tpill90 👏 |
src/Spectre.Console/Live/Progress/Columns/TransferSpeedColumn.cs
Outdated
Show resolved
Hide resolved
I pushed up another commit which should take care of the latest comments you've left on the review @FrankRay78 . A follow up question, what documentation should I be updating with this PR? I'll gladly update it, I just was waiting for things to get closer to being merged before going through all of it 😄 |
I've been thinking about documentation. Strictly speaking, the xml comments on things like the ShowBits property will end up in the auto generated API reference, however I notice the Progress page code example doesn't include the Download progress column, see: https://spectreconsole.net/live/progress I think it might be enough to just add that into the example, so it becomes obvious to casual readers that such a thing exists. |
Frigging awesome coding @tpill90, I think we are good with the PR review. I'm just looking at the documentation and playing around with some exploratory use of the Download/TransferSpeed columns to get a better idea of what we might want to explain to users. Feel free to do the same, and/or I'll write my suggestion once done. We can always discuss if we have differences of opinion. |
FYI. I've suggested a couple of final changes, here to consider, prior to merging. |
Context
Currently the
TransferSpeedColumn
is displaying the transfer speed using the binary/IEC definition of a kilobyte/megabyte/gigabyte (1024x)Typically, network transfer speeds are specified using the decimal definition (1000x), for example Ethernet (10/100/1000BASE-T), or internet connection speeds (100mbit = 100,000,000,000)
https://en.wikipedia.org/wiki/Binary_prefix#Data_transmission_and_clock_rates
Describe the solution you'd like
I would like to propose adding the ability to configure which binary prefix (1000x or 1024x) is used for display, as well as configuring to display either bits/s or bytes/s. This would allow developers to be able to tweak formatting to better match their use case.
The default display format would be to continue to use the current format, 1024x , as to ensure that there are no unexpected changes to the existing behavior when updating to a newer version of the package.
Using a data transfer rate of 1,000,000 bytes, the expected output for each configurablee option would be as follows :
Testing
These changes have been in use for about a month now in my projects steam-lancache-prefill and battlenet-lancache-prefill, and have been able to be tested and proven to be working, as well as being able to smooth over any unexpected edge cases.
Example output of the change :

Related commit, where changes started to be used
Please upvote 👍 this pull request if you are interested in it.