Random tip for comparing the performance of Rust and C programs that use stdout:
Rust stdout is line-buffered, even when redirecting to a file.
Glibc (and most C libraries I know of) are smarter than this, and will switch to a more aggressive buffering scheme if they aren't writing to a terminal.
Running the program _under hyperfine_ is enough to trigger this behavior, because hyperfine takes over the stdout stream. Glibc senses that this is not a terminal and turns on a 4096-byte buffer; Rust continues making one syscall per line.
So if a Rust program that prints stuff seems to lose a performance advantage over a C counterpart when run under hyperfine, it's worth stracing to check.
(There's continuing talk of fixing this default in Rust, but it's not fixed yet.)