3 ms·
Which is the great tragedy of our age. What a colossal waste
by JoeAltmaier 12y ago
Which is the great tragedy of our age. What a colossal waste
- smorrow 12y 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 12y 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 12y 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 12y agoThe OPs point was, there are essentially no more BE boxes.
- limeyx 12y agoNot for networking...ntohl/htonl and friends are no-ops (macros) on BE machines ... zero overhead
- wyager 12y ago> What a colossal waste How expensive do you think endianness-swapping is?
- jcranmer 12y ago<http://www.agner.org/optimize/instruction_tables.pdf> http://www.agner.org/optimize/instruction_tables.pdf> About 1 clock cycle per word.
- jdmichal 12y agoFixed link: http://www.agner.org/optimize/instruction_tables.pdf http://www.agner.org/optimize/instruction_tables.pdf
- curun1r 12y agoMiniscule multiplied by massive.
- JoeAltmaier 12y 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 12y 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.