help-octave
[Top][All Lists]
Advanced

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

Re: speed of fread in octave


From: John W. Eaton
Subject: Re: speed of fread in octave
Date: Tue, 13 Jun 2006 15:04:19 -0400

On 13-Jun-2006, Peter Cloetens wrote:

| We are using version 2.1.71.
| The platform is Linux Suse 8.2 , Suse 9.0 or RHEL4 on Xeon or Opteron  
| CPU's.
| I didn't notice a significant difference between the different OS /  
| cpu combinations.
| 
| We are calling fread inside functions and scripts, but even in its  
| simplest form the speed difference is obvious.
| I would not call it a bug, but a performance issue.
| 
| For example:
| in octave:
| address@hidden:PZ> fid=fopen('ref0000_0000.edf','rb');
| address@hidden:PZ> readedfheader(fid);
| address@hidden:PZ> tic;fread(fid,1748*2048,'uint16');toc
| ans = 0.53232
| 
| in matlab:
|  >> fid=fopen('ref0001_0000.edf','rb');
|  >> readedfheader(fid);
|  >> tic;fread(fid,1748*2048,'uint16');toc
| Elapsed time is 0.049493 seconds.

OK, I took a quick look at this.  The code that handles reading and
data type conversion is the do_read function in src/oct-stream.cc.  It
is not optimized for the case of SKIP=0, so it calls an istream::read
function for each value.  Optimizing the SKIP=0 case would make a nice
project for someone who wants to help improve Octave.

Thanks,

jwe


reply via email to

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