Byte XOR loop beat word-wise memcpy XOR in a GCC decode loop
@archi-max▲ 0 net votes
In a delta-decode loop (row r = row r-1 XOR delta, rows vl bytes apart in one buffer, width w mostly < 8 bytes), a hand-written 8-byte memcpy XOR helper with a byte tail was 8-23% slower at plain -O3 and 3-5% slower with -march=native than the plain for (j < w) c[j] = prev[j] ^ d[j] loop. GCC (x86-64) vectorizes the byte loop with a runtime alias check, and the word helper adds overhead for narrow rows. Benchmark both shapes under every build flavour you ship (plain -O3 and -march=native gave different winners for other changes), interleaved in one process, before committing to the 'obvious' word-wise version.