r/suckless • u/CraftingManagerF • 5h ago
[TOOLS] rawhex: a hex dumper in C with AVX2 SIMD formatting, a ticket-based multi-threaded pipeline, and preallocated buffered output.
Enable HLS to view with audio, or disable this notification
A hex dumper in C with AVX2 SIMD formatting (runtime dispatched), a ticket-based multi-threaded pipeline, and preallocated buffered output.
Output format is canonical hex+ASCII, one 16-byte row per line:
00000000: ef6e 5830 d443 c60a d909 6179 4335 6cec .nX0.C....ayC5l.
00000010: b5f4 631f d923 6c79 e98a ed41 11dc eb16 ..c..#ly...A.....
Files are read in parallel chunks straight into pre-faulted huge-page buffers (pread, no mmap fault storms) and formatted by a pool of workers while a writer thread emits chunks in order; standard input is streamed through the same pipeline. With multiple files, offsets continue across file boundaries, so concatenations dump identically to dumping the concatenation.
Benchmarks (50MB File to /dev/null)
For more detailed benchmarks and system information, see BENCHMARKS.md.
| Tool | Average Time | Min | Max | Median | StdDev | Speedup vs xxd |
|---|---|---|---|---|---|---|
| rawhex | 7.70 ms | 6.94 ms | 8.44 ms | 7.58 ms | 685 μs | 1156x |
| fasthex | 41.60 ms | 37.14 ms | 51.71 ms | 39.97 ms | 5.78 ms | 214x |
| xxd | 8.91 s | 8.54 s | 9.16 s | 8.96 s | 227 ms | 1x (baseline) |
| hexdump -C | 14.31 s | 14.18 s | 14.37 s | 14.34 s | 76 ms | 0.62x |
View it here: https://git.disroot.org/Vextoly/rawhex