The benchmark itself is slow, actual difference in performance is much higher.
$ make benchmark
...
/usr/bin/clang++ --version
clang version 12.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
/usr/bin/clang --version
clang version 12.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
rustc --version
rustc 1.54.0 (a178d0322 2021-07-26)
...
hyperfine \
'benchmark/target/release/benchmark ./libmydriver-c.so' \
'benchmark/target/release/benchmark ./libmydriver-c-fast.so' \
'benchmark/target/release/benchmark ./libmydriver-cpp.so' \
'benchmark/target/release/benchmark ./libmydriver-rs.so'
Benchmark #1: benchmark/target/release/benchmark ./libmydriver-c.so
Time (mean ± σ): 1.417 s ± 0.015 s [User: 1.415 s, System: 0.002 s]
Range (min … max): 1.395 s … 1.452 s 10 runs
Benchmark #2: benchmark/target/release/benchmark ./libmydriver-c-fast.so
Time (mean ± σ): 343.1 ms ± 19.8 ms [User: 340.3 ms, System: 2.9 ms]
Range (min … max): 321.7 ms … 376.5 ms 10 runs
Benchmark #3: benchmark/target/release/benchmark ./libmydriver-cpp.so
Time (mean ± σ): 308.0 ms ± 15.3 ms [User: 307.5 ms, System: 0.9 ms]
Range (min … max): 290.5 ms … 338.2 ms 10 runs
Benchmark #4: benchmark/target/release/benchmark ./libmydriver-rs.so
Time (mean ± σ): 1.249 s ± 0.026 s [User: 1.249 s, System: 0.001 s]
Range (min … max): 1.206 s … 1.276 s 10 runs
Summary
'benchmark/target/release/benchmark ./libmydriver-cpp.so' ran
1.11 ± 0.08 times faster than 'benchmark/target/release/benchmark ./libmydriver-c-fast.so'
4.06 ± 0.22 times faster than 'benchmark/target/release/benchmark ./libmydriver-rs.so'
4.60 ± 0.23 times faster than 'benchmark/target/release/benchmark ./libmydriver-c.so'
Run make fold_dirs
before build (gist does not support directories)