help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slowness in function 'open'


From: Muthiah Annamalai
Subject: Re: Slowness in function 'open'
Date: Thu, 21 Jun 2007 16:27:29 -0500



On 6/21/07, Mark B. <address@hidden> wrote:


Dmitri A. Sergatskov wrote:
>
> You can try low-level i/o functions.
> Assuming your big file is many lines long with 3 columns of data
>
> fh = fopen('mybigfile");
> a=fscanf(fh, "%f %f %f", [3, inf]);
>
> will be perhaps the fastest way to read it in octave.
>

Thanks Dmitri, this improved the performance although not that much. These
are my new results:

GNU Octave, version 2.9.12 (configured for "i686-pc-msdosmsvc")
***************************************************
%Before the first run I flushed the cache of the location where 'mybigfile'
resides

octave.exe:1> tic; fh = fopen('mybigfile'); values=fscanf(fh, '%d', [1,
inf]);  toc;
Elapsed time is 53.413849 seconds.

%Before the next run I flushed the cache of the location where 'mybigfile'
resides

octave.exe:2> tic; fh = fopen('mybigfile'); values=fscanf(fh, '%d', [1,
inf]);  toc;
Elapsed time is 53.468552 seconds.
***************************************************


Matlab version 7.3.0.267 (R2006b)
***************************************************
%Before the first run I flushed the cache of the location where 'mybigfile'
resides

>> tic; fh = fopen('mybigfile'); values=fscanf(fh, '%d', [1, inf]);  toc;
Elapsed time is 7.740050 seconds.

%Before the next run I flushed the cache of the location where 'mybigfile'
resides

>> tic; fh = fopen('mybigfile'); values=fscanf(fh, '%d', [1, inf]);  toc;
Elapsed time is 7.708370 seconds.
***************************************************

In this case although Octave was 1.84 times than using its 'load' function
(Matlab was 3.60 faster than its 'load' function), Octave is still a bit
slow.

Does anybody else know how to improve these times?

Thanks
--
View this message in context: http://www.nabble.com/Slowness-in-function-%27open%27-tf3960902.html#a11241801
Sent from the Octave - General mailing list archive at Nabble.com.

_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave



I have yet another "work around". You can try doing a C++ version
of 'your-load-function' on the file, if that can help. But Im not too sure
 if you can cut down the times any further.

But if I could help it,  I would probably copy the code in Octave's binary
save/load part to the magic C++ program in the batch and add flags to
output in a format that is Octave compatible, instead of making Octave
sing and dance....

-Muthu


reply via email to

[Prev in Thread] Current Thread [Next in Thread]