Fix data size calculation in the Network panel
Categories
(DevTools :: Netmonitor, defect, P2)
Tracking
(firefox106 fixed)
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: Honza, Assigned: bomsy)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
The Network panel is using kB/MB labels for (request/response/headers/etc.) sizes, which corresponds to the following definition:
1 kB = 1 kilobyte = 1000 bytes = 10^3 bytes
1 MB = 1 megabyte = 1000^2 bytes = 10^6 bytes
But, the code performs 1024-based calculations.
It's using 1024 based calculation
Should be fixed to 1000
Honza
Comment 1•5 years ago
|
||
Hey Honza, I'd like to fix this one;
The only thing to do is just update the constant?
Reporter | ||
Comment 2•5 years ago
•
|
||
Correct. And also, please test carefuly with various responses, compare with chrome devtools of file explorer, etc.
Honza
Comment 3•5 years ago
|
||
Comment 4•5 years ago
|
||
@Honza, did you check my last comment on Phabricator?
Reporter | ||
Comment 5•5 years ago
|
||
Sorry for the delay, commented on Phab now.
Honza
Reporter | ||
Comment 6•5 years ago
|
||
@ MarianaPicolo: just posted a comment to Phab, some tests need to be updated too (just adjust the expected size)
Honza
Comment 7•4 years ago
|
||
Because this bug's Severity has not been changed from the default since it was filed, and it's Priority is P3
(Backlog,) indicating it has been triaged, the bug's Severity is being updated to S3
(normal.)
Comment 8•4 years ago
|
||
We need to be careful with this to consider our options further. 1024 is deeply embedded in developer's brains, while the subtle difference in naming conventions are not. Maybe fixing the labels/tooltips for clarity could also help with this.
Related: https://twitter.com/digitarald/status/1263151454480510976 .
Reporter | ||
Comment 9•4 years ago
|
||
So, looks like 1024 is the way to go (81%)
@MarianaPicolo: are you still working on this?
Honza
Comment 10•4 years ago
|
||
The poll results might just indicate the current state of things, which is confusing since various apps use the same "kB" label to mean different things (despite there being a clear definition for what it means). There's an opportunity to reduce overall confusion and educate developers at the same time, regardless of how we end up solving this (either by clarifying the labels by using "KiB" for 1024-based units, or by continuing to use "kB" labels but ensuring 1000-based calculations).
E.g. Apple's HIG specifies that all data units should be 1000-based in macOS itself and in all macOS apps. (Ironically, the Safari DevTools use 1024-based numbers, but since that's a HIG violation that's a bug.) Inspecting a 1000-byte file in the macOS finder shows 1 kB, whereas inspecting a network request for the same file in Firefox DevTools currently says something else, which is confusing in and of itself. (Chrome has the same problem currently.)
Test resources:
https://mathiasbynens.github.io/css-dbg-stories/1000.txt
https://mathiasbynens.github.io/css-dbg-stories/1024.txt
Comment 11•4 years ago
|
||
Per the earlier consensus (before comment #8), Chrome DevTools now consistently uses 1000-based units with the proper SI labels: https://bugs.chromium.org/p/chromium/issues/detail?id=1035309 It would be great if Firefox DevTools would do the same. :Honza, WDYT?
Comment 12•4 years ago
|
||
This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.
Comment 13•4 years ago
|
||
Hello Everyone,
What is the status of this bug, can I work on this?
Ankit.
Reporter | ||
Comment 14•4 years ago
|
||
Hi Ankit,
thank your for your interest in helping DevTools!
We had a meeting about this couple months ago and decided to keep the logic as is, i.e keeping 1024 calculation as well as the labels.
(In reply to Mathias Bynens from comment #11)
Per the earlier consensus (before comment #8), Chrome DevTools now consistently uses 1000-based units with the proper SI labels: https://bugs.chromium.org/p/chromium/issues/detail?id=1035309 It would be great if Firefox DevTools would do the same. :Honza, WDYT?
Thank you Mathias for the links!
For now, it isn't easy to find consensus even if I'd be happy if DevTools (cross-browser) had the same view on this.
Honza
Comment 15•4 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #14)
We had a meeting about this couple months ago and decided to keep the logic as is, i.e keeping 1024 calculation as well as the labels.
May I ask for the reasons you decided to keep the current logic? I have to admit that I never really thought much about it earlier, though the calculations and labels are clearly wrong regarding their definition.
I think the most logical would be to switch to 1000-based calculation as I assume only a small percentage of developers know about the 1024-based units. And to be precise, "KB" then should be renamed to "kB".
Sebastian
Reporter | ||
Comment 16•4 years ago
|
||
Harald's twitter poll showed that people expect 1024 and in such case we would have to use "KiB/MiB" and those labels could be confusing to users. Personally, it would be ok for me to use 1000 based calculation.
Honza
Comment 17•4 years ago
•
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #16)
Harald's twitter poll showed that people expect 1024 and in such case we would have to use "KiB/MiB" and those labels could be confusing to users.
I'd argue the current "KB" labeling is way more confusing, because it's ambiguous. Upon seeing KB as a user, I always have to guess: did you mean "kB" (1000 bytes) or KiB (1024 bytes)? Turns out that in this case you meant KiB (but e.g. the macOS Finder uses the same "KB" label to mean "kB").
As a user, I don't have a strong preference w.r.t. using 1000- or 1024-based units (although I would love alignment between all browser DevTools!). Using precise labels seems uncontroversial though.
Comment 18•4 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #14)
We had a meeting about this couple months ago and decided to keep the logic as is, i.e keeping 1024 calculation as well as the labels.
If you keep 1024-based calculations, you must use the binaries prefix that corresponds to this 1024-based.
I understand that the type of calculation can be debatable, but the calculation and the label must be consistent to not display false size.
Comment 19•4 years ago
|
||
Now seems like a good time to revisit this discussion: Safari just fixed https://bugs.webkit.org/show_bug.cgi?id=208190 and is now using 1000-based units, as per the Apple HIG. Chrome DevTools has already been doing the same for almost a year. If Firefox DevTools would align, then all browser DevTools would denote file/memory sizes consistently! That would be amazing for web developers.
Updated•2 years ago
|
Comment 20•2 years ago
•
|
||
Reopening per the last comment from Mathias, if all other DevTools switched to 1000 based units, we should probably do the same.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 21•2 years ago
|
||
The bug assignee is inactive on Bugzilla, and this bug has priority 'P2'.
:Honza, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 22•2 years ago
|
||
I'm picking this up to complete it.
Updated•2 years ago
|
Comment 23•2 years ago
|
||
Comment 24•2 years ago
|
||
bugherder |
Description
•