note 13092 deleted from function.filesize by jimw
| From: | jimw@php.net | Date: | Fri, 14 Dec 2001 20:16:59 +0000 |
| Subject: | note 13092 deleted from function.filesize by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22717@lists.php.net to get a copy of this message | ||
About capitalization:
using ISO/USI notation for multiples,
k is for "kilo-" or 1000^1 (no problem)
M is for "mega-" or 1000^2 (not 1024^2!)
m is for "milli-" or 1000^-1 (not 1000^2!)
g is for "gram" weight unit, or 1000^-1 kilogram unit (not 1000^3!)
G is for "giga-" or 1000^3 (not 1024^3!)
T is for "tera-" or 1000^4 (not 1024^4!)
This adds to the confusion, especially when mixing computer units (such as bits and bytes) and
ISO/USI units (such as seconds):
What does "1Mb/s" mean ? Sure it should be read as "one megabit per second", but
what is then "one megabit" in that case ?
* 1000^2 b/s (ISO/USI convention for units with seconds), or:
* 1024^2 b/s (computer convention for units with bits)...
The choice is not easy, as it depends on the application:
* when dealing with storage media and communications, traditionally the ISO/USI is applied by
manufacturers of hardware, because they have to deal with many other physical specifications
(bandwidth and frequencies, spacial density, phase shifts, ...) and in all ISO standards, so
1Mb/s=1000^2 bits/second.
* Only in computer programs we use the computer convention because it's easier to compute
allocation space with powers of 2 (this alos applies to file sizes). But this has sweeped into
hardware too: processor and memory module manufacturer use powers of 2, not power of ten. Such usage
is purely machine related, but not human convenient.
There are areas where both domains collapse: when displaying file download rates. Traditionnaly,
humans do not need the details of bits physically transported on the network. They prefer to see
useful filesizes. So they use bytes, not bits. But because the file will be stored in a visible
directory, they want units in power of 2 (Kilo, Mega, and so on). So the byte rate is often given in
bytes per seconds using powers of 2 for multiples: 1KB/s is then exactly 1024 useful bytes per
second.
When they want to see the bit rate, they want to compare it to the modem or network media physical
speed (which is given in powers of 10). So you should display "1 kb/s" for exactly 1000
bits physically transmitted per second. Add to this that in that case, "8 b/s = 1 B/s" is
completely wrong, because of byte encoding on the network media !
* With slow modems (before V32), you have:
10 b/s ~ 1 B/s, or identically:
10 kb/s ~ 1000 B/s = 0.977 KB/s
(without counting any overhead for PPP, IP or TCP which take about 8 additional % of the bit rate!)
~ 925 B/s = 0.90 KB/s
(counting protocol overhead)
3This figure can be increased on some files by using data compression by modem hardware or by the
PPP protocol so that:
10 kb/s ~ 1.5 KB/s
(using compression factor 5/3)
(Most modems support native hardware compression. But the compression factor depends on the kind of
file to transmit. A value of 5/3 is a rough estimate for HTML and text files).
For the axact transfer speed, adjust the numbers proportionally.
Tradictionally, most V34 modem can connect at 33600 b/s = 33.6 kb/s, and they transmit files at 3.0
KB/s (without compression), or 5.0 KB/s (with a 5/3 compression).
* With synchronous modems (V32, V34, 2V90), the byte encoding on the media is much more efficient:
8.5 b/s ~ 1 B/s, or identically:
10 kb/s ~ 1175 B/s = 1.15 KB/s
(without counting protocol overhead)
~ 1082 B/s = 1.05 KB/s
(counting 8% protocol overhead)
~ 1800 B/s = 1.75 KB/s
(with a 5/3 compression factor)
Tradictionally, most V90 modem can connect at 42000 b/s = 42.0 kb/s, and they transmit files at 4.4
KB/s (without compression), or 7.4 KB/s (with a 5/3 compression).
* On LAN, protocol overhead is often less than 8% (because of larger packet sizes, and less errors).
So if we assume a protocol overhead of 4%, we get:
8.2 b/s ~ 1 B/s, or identically
10 kb/s ~ 1220 B/s = 1.20 KB/s
(without counting protocol overhead)
~ 1170 B/s = 1.14 KB/s
(counting 4% protocol overhead)
~ 1950 B/s = 1.90 KB/s
(with a 5/3 compression factor)
Tradictionally, most LAN can connect at 10000000 b/s = 10 Mb/s, and they transmit files at 1.11 MB/s
(without compression). With a data compression, you could go up to 1.85 MB/s (with a 5/3
compression).
Note that data compression is not traditionally used over LAN with the current implementation of
protocols (unless virtual networks with PPTP are used which support data compression).
With file transfer speeds you then use completely different systems of mesure!
Please use the correct units!