I’ve recently discovered that MB/s is technically equivalent to 8 million bits/s
and not 10242 bits per second which should be called a Mebibyte.
This should be easy, but when comparing output from various sources I get different answers, even from google which thinks there is no difference at all between the measures.
If I transfer 1381530 bytes in 17797601 nanoseconds, what is the data rate in those two measures? and what is the formula you’re using to calculate it?
Currently I have: where duration is in nanoseconds.
double data_rate_MiBps = (num_bytes/1024/1000) / ((double)duration * 1e-9);
double data_rate_MBps = (num_bytes/1024/1024) / ((double)duration * 1e-9);
Thanks for the responses. I was ending up with numbers that didn’t make sense before but now they do. The above code should be the following:
double data_rate_MiBps = (num_bytes/1024.0/1000.0) / ((double)duration * 1e-9);
double data_rate_MBps = (num_bytes/1024.0/1024.0) / ((double)duration * 1e-9);
I therefore get:
74.085 MiB/s
75.863 MB/s
Which I think makes sense.
Probably a better question. Why in the first place was 1024 bytes chosen to be 1KB instead of 1000. Since Kilo (etc) = 1000 everywhere else.
0.0776 bytes/ns.
First, careful:
I’ve never heard of this definition.
"MB/s" usually means "megabytes per second". This can be one of two definitions, depending on who you ask:
In some really, really rare cases, "MB/s" could mean "megabits per second", but megabits per second is usually abbreviated to "Mbps" or "Mbits/s". The context will most often clue you in on which is appropriate: wireless transmission speeds, ethernet cards, etc. are typically measured in megabits per second; file transfers over the internet are measured in megabytes (or mebibyte, see next paragraph) per second.
The IEEE has proposed that computers should follow the SI prefixes, and use "Kilobyte" to mean 103 bytes, not 210 bytes, which has been done historically. (And thus created all the confusion over which definition of a megabyte one is actually using.) However, in many contexts, 103 makes little sense, so different "binary" prefixes were introduced, such as the "Kibibyte", which is abbreviated KiB and always means 1024 bytes. In your case, there is it "Mebibyte", or MiB (and when per second, MiB/s) and means 1024*1024 bytes.
See the Wikipedia article on the Megabyte for more info.
(For the conversions to bits/s, I’ve assumed 8 bits/byte.)