But for example bitmaps in BE are a huge source of bugs, as readers and writers need to agree on the size to use for memory operations.
"SIMD in a word" (e.g. doing strlen or strcmp with 32- or 64-bit memory accesses) might have mostly fallen out of fashion these days, but it's also more efficient in LE.
I used to like big endian more, but after deep investigation I now prefer little endian for any encoding schemes.
E.g. decimal example:
1.00/1.00 = 1.00
1.000/1.001 = 0.999000999000...
(adding one more bit changes the first bits of the outcome)For example, with ULEB128 [1], you just read 7 bits at a time, going higher and higher up the value you're reconstituting. If the value grows too big and you need to spill over to the next (such as with big integer implementations), you just fill the last bits of the old value, then put the remainder bits in the next value and continue on.
With a big endian encoding method (i.e. VLQ used in MIDI format), you start from the high bits and work your way down, which is fine until your value spills over. Because you only have the high bits decoded at the time of the spillover, you now have to start shifting bits along each of your already decoded big integer portions until you finally decode the lowest bit. This of course gets progressively slower as the bits and your big integer portions pile up.
Encoding is easier too, since you don't need to check if for example a uint64 integer value can be encoded in 1, 2, 3, 4, 5, 6, 7 or 8 bits. Just encode the low 8 bits, shift the source right by 8, repeat, until the source value is 0. Then backtrack to the as-yet-blank encoded length field in your message and stuff in how many bytes you encoded. You just got the length calculation for free. Use a scheme where you only encode up to 60 bit values, place the length field in the low 4 bits, and Robert's your father's brother!
For data that is right-heavy (i.e. the fully formed data always has real data on the right side and blank filler on the left - such as uint32 value 8 is actually 0x00000008), you want a little endian scheme. For data that is left-heavy, you want a big endian scheme. Since most of the data we deal with is right-heavy, little endian is the way to go.
You can see how this has influenced my encoding design in [2] [3] [4].
[1] https://en.wikipedia.org/wiki/LEB128
[2] https://github.com/kstenerud/concise-encoding/blob/master/cb...
[3] https://github.com/kstenerud/compact-float/blob/master/compa...
[4] https://github.com/kstenerud/compact-time/blob/master/compac...