help-octave
[Top][All Lists]
Advanced

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

Re: Slowness in function 'open'


From: Mark B.
Subject: Re: Slowness in function 'open'
Date: Thu, 21 Jun 2007 14:17:53 -0700 (PDT)


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.



reply via email to

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