benchpress: A Self-Building Benchmark Harness Generator

Recently, I was bored and decided to test the performance of a 4x4 matrix multiply. I wanted to compare how GCC and Clang optimize the same code with different flags. So I manually wrote a benchmark harness using a neat trick: a C file that&rsquo;s also a valid shell script. The idea is simple. You embed shell commands in C comments at the top of the file. When you run sh benchmark.c , the shell…