I believe your filesize "rounding" algorithm is a bit off, hence it creates unnecessary alignment issues on the Net Tab that is used to check webpage component load times.
Attached image will explain it better than me.
Thanks.
Comment #1
Posted on Jul 1, 2013 by Helpful WombatEverything less than 1 KB will be displayed in bytes and when the decimal places are 0, they are not displayed.
What would you expect?
Sebastian
Comment #2
Posted on Jul 1, 2013 by Helpful LionI guess I expected the numbers to line up.
Personally, I'd display 7 KB (7196 B) as 7.0 KB so it aligns with the other KB sizes.
I understand the difficulty with 1014 since it is technically .99 KB, but I'd still round it up to 1.0 KB, heck it's only 10 B away.
Thanks for looking into it.
I'll get used to the way things are.
Comment #3
Posted on Jul 2, 2013 by Helpful WombatBoth sounds reasonable to me, though rounding to full KB may depend on personal taste. Honza, what do you think?
Sebastian
Comment #4
Posted on Jul 2, 2013 by Massive WombatI'd display 7 KB (7196 B) as 7.0 KB so it aligns with the other KB sizes. Make sense to me.
I'd still round it up to 1.0 KB, heck it's only 10 B away. Also make sense, just what would be the minimal value for which we display 1.0 KB?
Honza
Comment #5
Posted on Jul 2, 2013 by Helpful WombatI'd display 7 KB (7196 B) as 7.0 KB so it aligns with the other KB sizes. Make sense to me. Ok, so this issue should at least cover that.
just what would be the minimal value for which we display 1.0 KB? Mathematically it would be at 973 bytes. Though it would be a bit inconsistent to use that as threshold.
I had a look what the other dev tools do and it seems every tool is displaying the sizes a bit differently. See the attached screenshots. Further investigations show taht e.g. the Firefox dev tools have KB as minimum unit, the IE dev tools have a threshold at 500 bytes to display the sizes in KB. Opera Dragonfly and the Chrome DevTools do it the way we show the sizes, i.e. show them in bytes up to 1023 bytes.
So I see two options for us: 1. Keep the threshold as it is 2. Use KB as minimum unit
Sebastian
- netRequestSizeChromeDevTools.png 54.29KB
- netRequestSizeFirefoxDevtools.png 184.01KB
- netRequestSizeIEDevTools.png 41.18KB
Comment #6
Posted on Jul 4, 2013 by Massive WombatI like what Opera Dragonfly and the Chrome DevTools do, so (note the comma) I'd keep it as it is.
I still think we should change 7 KB to 7.0 KB
Honza
Comment #7
Posted on Jul 5, 2013 by Helpful WombatI still think we should change 7 KB to 7.0 KB At a first glance you would think this looks like an easy little change by using toFixed()[1], though it can get complicated when you want to keep locale string formatting.
Maybe we should wait until the ECMAScript Internationalization API Specification[2] is implemented[3] and we have access to Intl.NumberFormat()[4].
Sebastian
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed [2] http://www.ecma-international.org/ecma-402/1.0/ [3] https://bugzilla.mozilla.org/show_bug.cgi?id=837963 [4] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat
Comment #8
Posted on Jul 5, 2013 by Helpful WombatReconsidered this and created a new formatting function Str.toFixedLocaleString() for this, which can be simplified when the Internationalization API has landed in Firefox.
Fixed in https://github.com/firebug/firebug/commit/63d508fde7b90ab6fb257f3bf8f348a26c279328 and https://github.com/firebug/firebug/commit/8336bbe2bc4f819b3212e9f28c428c1b64306ffb.
Sebastian
Comment #9
Posted on Jul 5, 2013 by Helpful Wombatdo, so (note the comma) I'd keep it as it is. Good! :-)
Sebastian
Comment #10
Posted on Jul 5, 2013 by Massive WombatThis issue has been fixed in Firebug 1.12 beta 2 https://getfirebug.com/releases/firebug/1.12/firebug-1.12.0b2.xpi
Please try it and let us know if it works for you.
Thanks for the help! Honza
Comment #11
Posted on Jul 15, 2013 by Helpful WombatCreated FBTest for size formatting function test in https://github.com/firebug/firebug/commit/dd7535710f942943a9c1db1915e0b28451644ef2.
Sebastian
Status: Fixed
Labels:
Type-Enhancement
net
1.11.4
Test-case-needed
FBTest-wanted
fixed-1.12-b2