r/linuxprojects • • Aug 18 '26

⚙️ CLI Tool rawhex: Ultra-fast hex dumper in C with AVX2 SIMD formatting, a ticket-based multi-threaded pipeline, and zero-copy 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.....

Benchmarks

All timings below were measured with rawbench (after warmup) on 100 MB of random data.

vs. fasthex (v0.3.1)

Default thread counts:

Scenariorawhexfasthexfasthex --color=neverSpeedup
file → /dev/null18 ms91 ms83 ms4.6x
file → regular file276 ms394 ms-1.4x
file → pipe94 ms111 ms-1.2x
stdin → /dev/null29 ms113 ms103 ms3.6x
single thread (-j 1)37 ms80 ms82 ms2.2x
Binary size46 KB668 KB--

Speedup is against fasthex's faster variant per scenario (default or --color=never; disabling color saves fasthex ~8-10%).

Single-threaded formatting throughput (-j 1): ~11 GB/s of formatted output. With the default thread pool the same 100 MB file formats in ~18 ms (writing 425 MB of output), within ~3x of the raw cat read floor for the input alone.

vs. classic tools

Same 100 MB input. The classic tools are single-threaded scalar formatters, so the gap is orders of magnitude:

ToolTimeSpeedup vs tool
rawhex18 ms-
xxd (vim)19.2 s1067x
hexdump -C (util-linux 2.42.1)30.6 s1700x

View it here: https://git.disroot.org/Vextoly/rawhex

The code & readme contains AI-generated segments.

3 Upvotes

0 comments sorted by