Page MenuHome

UI: Formatted Byte Strings on Windows
ClosedPublic

Authored by Harley Acheson (harley) on Sat, Sep 7, 5:39 PM.

Details

Summary

Users on the Windows platform expect to see strings representing byte sizes to be formatted in a different way than generally expected on Mac or Linux. This patch alters BLI_str_format_byte_unit() so that its output is platform-dependent. Windows users will see byte sizes formatted in Base 2 and with units that they are used to reading (KB, MB, GB).

This does not change how these strings are formatted on Mac and Linux, where they will continue to be shown using decimal formatting.

This really shouldn't be a matter of what is "better" or "correct" or "modern". It is about presenting information in a way that is expected by users in a form that they recognize. When viewing a list of files for example, it is very important that the sizes shown be the same as those shown by the Windows Explorer so that they can be recognized at the same files inside and outside of Blender. With differing calculation or differing units shown it just adds confusion for no gain to anyone.

Users should not have to know the history of the ambiguity of file size units. They just need to know that the file they are looking at in Blender is the same as the one they see outside of it. So it is important that we use both the value and units they expect.

An example bug report: https://developer.blender.org/T69455

Diff Detail

Repository
rB Blender

Event Timeline

William Reynish (billreynish) accepted this revision.

Frustrating that our supported platforms can't agree on this, but given that's the case, this seems ok.

This revision is now accepted and ready to land.Sat, Sep 7, 5:58 PM
Brecht Van Lommel (brecht) requested changes to this revision.EditedSat, Sep 7, 6:59 PM

Pleaseo only use the platform specific 1000 for the file sizes in the file browser, and for reporting memory usage always use 1024.

We have many places in Blender that report memory usage or compute cache limits for example, and those do not use BLI_str_format_byte_unit. We should not make those things platform specific.

This revision now requires changes to proceed.Sat, Sep 7, 6:59 PM

@Brecht Van Lommel (brecht) - > Please only use the platform specific 1000 for the file sizes in the file browser, and for reporting memory usage always use 1024.

Just to be clear, the CURRENT behavior (without this patch) is now showing memory sizes, cache size, and everything else with a base of 1000, not 1024. I think this was changed with File Browser redesign.

We have many places in Blender that report memory usage or compute cache limits for example, and those do not use BLI_str_format_byte_unit

Those things do call BLI_str_format_byte_unit() but are currently calling that function with an argument that makes them format in decimal.

So your preferences is that all things that show formatted byte sizes should use binary (1024-based) sizes, while file size reporting can vary by platform (1024 on Windows, 1000 on Mac and Linux)? That would mean that on Mac you are wanting to show file sizes in decimal and "MB" but then memory and other sizes in binary with "MiB"?

Updated to align with @Brecht Van Lommel (brecht)'s preferences.

  • Point Cache formatted memory size in Binary
  • EEVEE Light Cache formatted memory size in binary
  • Info Stats showing all memory in binary
  • File Sizes shown in Binary on Windows, Decimal on Mac and Linux.

Because this means we have a couple situations where multiple formats are shown on the same the platform (Mac File size versus Mac Memory) that means we are probably stuck with using the (relatively obscure) IEC abbreviations (MiB) whenever showing binary rather than JEDEC (MB) for memory. Should be okay and is pretty much what we had before the File Browser redesign.

We could, if you prefer, make some changes to allow just the memory reporting strings to calculate in binary but report the abbreviations almost always used for memory sizes, JEDEC (MB, GB) rather than the IEC prefixes. It would make the stat string look a little more normal for more people, since few see "MiB". But still might seem odd on Mac to see two different numbers reported as "MB" but calculated differently

This revision is now accepted and ready to land.Mon, Sep 9, 10:19 AM

For the records, the file browser redesign didn't change anything but the file browser file size strings. If master uses base 10 sizes, that was the case before the redesign.

@Julian Eisel (Severin) - For the records, the file browser redesign didn't change anything but the file browser file size strings. If master uses base 10 sizes, that was the case before the redesign.

Yes, that is indeed the case and sorry that I said what I did.