3 ms·
While I know the performance cost is relatively minimal, it's interesting to think about the collective cycles wasted byte swapping back/forth to big endian for
by tyingq 5y ago
While I know the performance cost is relatively minimal, it's interesting to think about the collective cycles wasted byte swapping back/forth to big endian for the network...now that little-endian machines dominate the landscape.
- acomjean 5y agoI wrote a library to endian swap last century. It was when our swap in test machine was x86 and our machines were PA-RISC or sparc. That combined with some serial port wiring fun made and otherwise great project 10% sucky. We did it in C and it was pretty fast.
- deleted 5y ago[deleted]
- monocasa 5y agox86 at least has movbe instructions these days for byte swapping loads/stores, so it's not the worse thing in the world.
- VWWHFSfQ 5y agoAt this point I would be surprised if there was any performance or energy cost at all. Every CPU has an endian bit-flipper now.
- hermitdev 5y agoNot just instruction cycles, but how many human cycles wasted, too? The years is 2021 and I'm dealing with yet another random bug somewhere because two sides of a serialization don't agree on an order...
- IshKebab 5y agoYeah there are still people who think network protocols have to use "network byte order". Most recent weird case I discovered is CBOR, which is reasonably well designed (it's hard to get binary JSON very wrong to be fair), but the designers inexplicably decided to use big endian. In 2013.
- Gibbon1 5y agoLorawan's protocol which is even more recent than that also uses big endian. Which is a serious head desk. It's seriously nothing but a pain in the ass.