Your workflow goes through five phases:
- writing of parameters in Octave,
- system() overhead of starting your executable,
- reading of data in your C++ code,
- calculation,
- output in C++ and input in Octave.
The actual amount of time spent in each one depends on your particular
case, e.g. how much data is involved. Doing it in an .oct function would
essentially reduce it to the calculation, and you can find out exactly
how much time it takes by modifying your C++ to calculate and print the
time from after reading the data to just before writing it out. Then,
wrap your Octave code to write the params, call system() and read the
results in the tic/toc pair, and subtract the C++ time from the
toc() value---it'll be your overhead.