As @Rotsor said, 16G / 55 hours of operations are around 80,000 operations per second, or one operation every 12.5 microseconds. This is a lot of time per operation.
This means that your loops are not the cause of poor performance, it is that in the innermost loop that takes time. And Octave is an interpreted language. This in itself means a slowdown.
If you need speed, you first need to compile the language. Then you need to perform performance tuning (aka profiling) or just perform one step in the debugger at the instruction level. It will tell you what it actually does in the heart. After you get it where it does not waste cycles, more powerful equipment, cores, CUDA, etc. Will give you acceleration of parallelism. But it is stupid to do this if your code takes too many loops. (Here's an example of performance tuning - 43x acceleration, just cutting fat off.)
I canโt believe that the number of respondents speaks about Matlab, APL and other vectorized languages. These are translators. They give you short source code, which is not at all the same as fast execution. When it comes to bare metal, they get stuck with the same equipment as any other language.
Added: to show you what I mean, I just ran this C ++ code that performs 16G operations on this moldy old laptop and it took 94 seconds or about 6 ns to iterate. (I can't believe that you baby sat for 2 whole days.)
void doit(){ double sum = 0; for (int i = 0; i < 1000; i++){ for (int j = 0; j < 16000000; j++){ sum += j * 3.1415926; } } }
Mike dunlavey
source share