News for hackers. Stuff that matters.
Re:Endianness, API Design, and Polymorphism in Rust by tyingq on Sunday November 28, 2021 @08:06PM (#29375132)
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.
Re:Endianness, API Design, and Polymorphism in Rust by hermitdev on Monday November 29, 2021 @12:51AM (#29376837)
Not 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...
Re:Endianness, API Design, and Polymorphism in Rust by VWWHFSfQ on Sunday November 28, 2021 @09:36PM (#29375710)
At this point I would be surprised if there was any performance or energy cost at all. Every CPU has an endian bit-flipper now.
Re:Endianness, API Design, and Polymorphism in Rust by monocasa on Sunday November 28, 2021 @09:00PM (#29375458)
x86 at least has movbe instructions these days for byte swapping loads/stores, so it's not the worse thing in the world.
Re:Endianness, API Design, and Polymorphism in Rust by IshKebab on Monday November 29, 2021 @11:01AM (#29381354)
Yeah 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.

Re:Endianness, API Design, and Polymorphism in Rust by Gibbon1 on Tuesday November 30, 2021 @03:31AM (#29390120)
Lorawan'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.

Re:Endianness, API Design, and Polymorphism in Rust by acomjean on Monday November 29, 2021 @01:01AM (#29376896)
I 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.