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: Wed, 14 Jun 2006 11:50:45 -0400

On 14-Jun-2006, David Bateman wrote:

| and the change would be to make the above become something like
| 
| resize the return matrix to the right size
| if (!skip) {
|    get fortran_vec of return matrix cast as char
|    read all required values from file
|    if (swap or float_conversion) do the byte swapping and format conversion
|    if didn't read necessary number of values resize return matrix
| } else {
|    as above
| }
| 
| it should be as you say a fairly easy change to make as all of the
| support code is already in place

Yes, that's essentially it.  For the best memory efficiency, you'll
want to do the byte swapping and format conversion in place (if
possible).  This may require a single temporary value, but should not
need an entire vector of temporary values.  This might be slightly
tricky if you are reading 16-bit integers and returning 32-bit
integers.  The code in liboctave/data-conv.cc should be improved or
extended to provide this functionality so that it might be used in
other parts of Octave.

jwe


reply via email to

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