pub fn tac_bytes(
data: &[u8],
separator: u8,
before: bool,
out: &mut impl Write,
) -> Result<()>Expand description
Reverse records separated by a single byte. Uses chunk-based forward SIMD scan processed in reverse order for maximum throughput — eliminates per-line memrchr call overhead. Output uses write_vectored (writev) for zero-copy from mmap’d data.
For data up to CONTIG_LIMIT, builds a contiguous reversed output buffer and writes it in a single write() call. This is faster for pipe output because it eliminates the overhead of many writev() syscalls (a 10MB file with 50-byte lines would need ~200 writev calls of 1024 entries each; a single 10MB write() is much faster).
For larger data, uses the writev approach to avoid doubling memory usage.