4 ms·
In the meantime, almost every bytestream sent over networks on planet Earth is BE, regardless of whether it's sent by or to a LE or BE machine.
by weland 11y ago
In the meantime, almost every bytestream sent over networks on planet Earth is BE, regardless of whether it's sent by or to a LE or BE machine.
- JoeAltmaier 11y agoWhich is the great tragedy of our age. What a colossal waste
- smorrow 11y agoIt's the same C code doing IP, going through the same steps and the same number of steps, whether the underlying machine is little- or big-endian. So if you're saying about wasted cycles...
- JoeAltmaier 11y agoThe waste is every little-endian machine (almost all machines) converting every packet to big-endian for 'the wire', then converting back again when received. Its all a pointless self-flagellation.
- smorrow 11y agoAny sensible code is going to have to do that stuff whether the machine's endianness matches IP's or not, though. It happens on BE boxes too. It's either that or write completely different code for different CPUs.
- JoeAltmaier 11y agoThe OPs point was, there are essentially no more BE boxes.
- limeyx 11y agoNot for networking...ntohl/htonl and friends are no-ops (macros) on BE machines ... zero overhead
- wyager 11y ago> What a colossal waste How expensive do you think endianness-swapping is?
- jcranmer 11y ago<http://www.agner.org/optimize/instruction_tables.pdf> http://www.agner.org/optimize/instruction_tables.pdf> About 1 clock cycle per word.
- jdmichal 11y agoFixed link: http://www.agner.org/optimize/instruction_tables.pdf http://www.agner.org/optimize/instruction_tables.pdf
- curun1r 11y agoMiniscule multiplied by massive.
- JoeAltmaier 11y agoExpensive in having to do it at all - code complexity, confusion between HBO and NBO buffers, heck the fact that nobody can even receive an opaque packet at all! You have to know every field to correctly normalize it on receive. This impacts code at every layer of the network.
- astrodust 11y agoShuffling bits around takes basically zero effort, there's often a CPU instruction to flop them. Re-doing everything to be the opposite polarity takes tons of effort.