Lists Home |
Date Index |
Bob Wyman wrote:
> Another thing to consider is the potential cost in converting
> data to address things like "endian" concerns. If you have to flip the
> bits in every number you get and you have many numbers, this can get
Hmmm... nowhere near as expensive as parsing those numbers from base 10
ASCII :-) A 32-bit endian swap in x86 assembly is not many instructions
- can't remember how many offhand, but not many. And it will execute in
constant time, whereas a base 10 decoder will take time linearly
dependant on the number of digits in the number :-)
> Similarly, converting from a "standard" floating point
> representation to some different representation supported by your
> machine or language might be expensive.
That has more scope for expense but, again, I can't see it ever being
worse than converting from a base 10 ASCII encoding of the same number.
> Also, if it turns out that
> your application is primarily concerned with large strings, then a
> binary format can deliver very disappointing results.
Yep, if we enclosed this entire email in <e> and </e> to make it into
XML, then the PER equivelant would be something like a 2-byte
variable-length integer encoding the message length followed by the text
of the message - a meager saving of 5 bytes out of a couple of K.
> bob wyman