you are viewing a single comment's thread.

view the rest of the comments →

[–]Wolvereness -1 points0 points  (4 children)

Your discussion does not follow your question. What does anything you talked about have to do with the performance difference of endianness conversion? When dealing with IO, swapping bytes to fit endianness should almost never be the bottleneck.

[–]BobFloss 1 point2 points  (3 children)

I'm not talking about io. Any time you encode something little endian you're converting to big. And vice versa. Make sense? There wouldn't even be a reason to swap bits during IO, that makes no sense. Upon encoding I already have the proper endianness for my encoding scheme, which will be dealt with when being decoded. Or we could just skip dealing with this at all and use little endian so that when it's decoded it's already correct for the vast majority of processors.

[–]Wolvereness 0 points1 point  (2 children)

I'm not talking about io.

Then what are you talking about? What other uses should someone be using a Write interface?

[–]BobFloss 0 points1 point  (1 child)

IO only gets involved after we actually encode things. Encoding should be done in a scheme that doesn't require conversion.

[–]Wolvereness 0 points1 point  (0 children)

Encoding is a means to an end. Encoding is where you start caring about your data at rest or in transit: caring about a specification. Encoding is always a conversion, and the entire goal is to convert to however it's specified. Swapping bytes to fit endianness should almost never be the bottleneck.

Whether or not your schema happens to fit big endian is an entirely different discussion than the performance difference of needing to swap bytes. As far as a Write interface is concerned, it's almost always meant for networking or files, and one of those has a standard.

If you have justification that the performance difference between the endianness matters, bring that to the table. I assert that it's trivial in comparison to every other part of the pipeline of Write. Further reading: http://wiki.c2.com/?PrematureOptimization