In theory, we could do something similar, i.e., just write our own
little utility program in C that implements the tests done in Octave
code. Since we are always using a C compiler, we could make the building
of this utility part of the Octave build process. For example, say the C
program (call it Cperf.c for now) generates as an output a string of
characters that lists the test and the CPU consumption:
systemcommline> Cperf
doubleForLoop/1: 181.8
doubleForLoop/a=1: 294.7
doubleForLoop/a=b: 275.6
doubleForLoop/a=a+b: 335.8
doubleForLoop/a=sin(b*i): 383.4
vectorOfSquares: 677.7
mandel: 224.9
fib: 687.6
parse_int: 2392.1
quicksort: 1244.9
pi_sum: 18236.1
rand_mat_stat: 572.8
rand_mat_mul: 515.9
printfd: 1233.3
Then, the Octave test script that implement perf.m could call the system
function Cperf to get the values and do the relative-to-C comparisons.
That seems like a pretty good comparison to me, and the benefit is we
know that Cperf is built with pretty much the same environment as Matlab
and is always present.