Re: Binary v. Text, why is it faster?




Arctic Fidelity wrote:
I have constantly seen and heard that reading binary data is faster than
reading textual data. I have always presumed this to be a fact. But now I
am at the point where I would like to understand why.

I was trying to think about it, and it has rather confused me. To my
understanding, reading a text file is reading in the bytes which
correspond to, for example, ASCII character codes. But if we are dealing
with a 1-byte character encoding, how is it slower to read in 'a' rather
than some binary representation of that?

And in addition to this, what is the actual difference between binary and
textual files? I had always thought that a binary file was simply a file
composed of any combination of bytes, whereas a text file was a file
composed of a limited subset of the bytes available to a binary file. Am I
misunderstanding something here?

I guess I just don't see how reading in AF would be slower just because AF
appears in a text file instead of a "binary" file?

- Arctic

What is text? What is binary? Both are stored in a binary format
fundamentally and this may be confusing you. Text is usually (but not
always, just to confuse you) stored in ASCII format.

Any CPU will have an internal representation of its number system (all
different, go look up endian on the web), but if you can write and read
in the 'native' number language of the CPU and avoid any translation
then you've jumped the translation hurdle. You've got to read that
number back on a compatible CPU to make sense of it.

Now, consider writing 10 'native' English numbers. If I asked you to
translate them into Japanese before writing them to paper then that
would take you some time - you don't natively know how to do that (or
I'd be surprised if you could). Now at some time later you have to get
them back - read the Chinese numbers back from the paper and translate
them back English 'native' language. So much effort huh?

Same with computers - if you avoid the translation you avoid the
overhead of all the lookups.

Be aware though, because of endian and other issues, especially around
floating point number implementations, if you write a binary file it
may not be portable between different CPU designs (or even compilers).
That's why ASCII text has ruled the planet for umpteen decades. Slower
but more readable. Anyone got a date on that ASCII invention?

Lucien Kennedy-Lamb

.



Relevant Pages

  • Re: Whats an acceptable temp increase when overclocking?
    ... that it is the likely source of the BIOS and Probe CPU temp readings. ... other temperature sensors. ... DTS measures relative temperature - a reading of -20C from the sensor ...
    (alt.comp.periphs.mainboard.asus)
  • Re: Whats an acceptable temp increase when overclocking?
    ... that it is the likely source of the BIOS and Probe CPU temp readings. ... other temperature sensors. ... DTS measures relative temperature - a reading of -20C from the sensor ...
    (alt.comp.periphs.mainboard.asus)
  • Re: Whats an acceptable temp increase when overclocking?
    ... that it is the likely source of the BIOS and Probe CPU temp readings. ... the DTS are on the silicon die of the processor. ... DTS measures relative temperature - a reading of -20C from the sensor ...
    (alt.comp.periphs.mainboard.asus)
  • Re: To Garamond: Genesis Commentary
    ... I do think it presents a few issues for a literal reading. ... "Tehom" is a cognate of the Babylonian Tiamat, ... Maybe it is, but if it is, then we'd need the nonliteral interpretation ... But my point is the translation you're reading is not faithful to the ...
    (talk.origins)
  • Re: To Garamond: Genesis Commentary
    ... Thanks for combining this into a single thread (which I'm promptly going ... do think it presents a few issues for a literal reading. ... Another way would be to suggest that there was an original true event ... translation to the historical study needed to determine the original word ...
    (talk.origins)