-
Notifications
You must be signed in to change notification settings - Fork 12
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
Dynamic units #2494
base: main
Are you sure you want to change the base?
Dynamic units #2494
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I agree it would be nice to get things into more natural units, though sometimes we might be abbreviating too much. Maybe it makes sense to always show some digits after the decimal? I know it's relatively rare to have exactly |
Should we use That might be less frequent with the dynamic units, but still. Especially where the units are set within a tile. My other question is whether those are the right thresholds to switch? I had a vague thought that we might have a preference for a unit and switch if it's significantly higher or lower but that's probably overcomplicating it. |
Lines 51 to 61 in 98103a2
|
Oh god, what am I saying. It says right there in Lines 68 to 94 in f6219f1
|
On the decimals / commas / return types … The good news is that the decimals are getting dropped because they're So — open to thoughts, but — I think we can leave them as-is, as the likelihood that they'll be an even BinaryUnit multiple — while non-zero (wokka wokka) — is probably low. |
We could/should calculate percentages from the raw byte values. |
Open to general conversation on this.
Currently, we have a few set units that we apply to our Memory (GiB) and Storage (TiB) utilization representations. The important thing is that they should be the same unit within each tile. Here are the tiles, for example:
As we move to having larger drives in the future, we probably won't be able to assume that GiB and TiB will be reliable values for the Memory and Storage tiles (and other representations). Note that 7,792.4 GiB is a bit unwieldy.
This PR introduces a dynamic way to determine the appropriate unit and to convert the numbers.
I am open to any thoughts on this. For example, is the core assumption here off? Is it more straightforward to a user to say
3000 GiB
rather than recasting it asTiB
?There are a few places where we'd need to revisit our existing "toGiB"-style conversions, but I think this is a good proof of concept so we can talk through it.
Here's one spot, for example, where we're always running a "to GiB" conversion (note the bottom row), but where a dynamic converter might make more sense …
… I was focused on embiggening the middle row, but then noticed that since I added the dynamic conversion, both rows now show the proper (TiB) value. (Note: TiB for the bottom row was because it was already large enough for that, not based off of the middle row's new TiB scale.)