Daniel J Sebald wrote:
2) Open the existing file in binary format first and scan--in binary
mode--for the number of new-line characters go get the M dimension.
Then close/open the file in text mode and scan the first row for N.
Rewind, and knowing M x N, off we go. Just run the existing
algorithm. I would think the first binary pass would be very quick.
This one is basically "word count", isn't it. I tried the following:
A = rand(1000,1000);
save -ascii test.m A
tic, load test.m; toc
Elapsed time is 15.198189 seconds.
Then
address@hidden ~]$ wc -l test.m
1000 test.m
comes back immediately. That would be a savings if Octave currently has
two identical passes. Factor of almost 2, perhaps? Saving to memory
isn't the slow part, so I'll guess factory of 1.85 to 1.9.