octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #54100] fread using SKIP larger than zero is e


From: Rik
Subject: [Octave-bug-tracker] [bug #54100] fread using SKIP larger than zero is extremely slow
Date: Fri, 20 Jul 2018 13:26:50 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Update of bug #54100 (project octave):

                  Status:                    None => Confirmed              
                 Release:                   4.4.0 => dev                    
        Operating System:       Microsoft Windows => Any                    

    _______________________________________________________

Follow-up Comment #10:

I took the first of the most obvious suggestions, calculating the size of the
file just once and storing eof_pos in a variable.  This produces a 2.5X
speed-up, and no regressions during testing, so I committed that change here
(https://hg.savannah.gnu.org/hgweb/octave/rev/336267b16a3d).

Test results were


-------------------------------------------------------------------------
Before
-------------------------------------------------------------------------
octave:18> tic; xt = fread (fid, [1000, 60], 'single', 0); toc
Elapsed time is 0.00138497 seconds.

octave:21> tic; xt = fread (fid, [1000, 60], 'single', 4); toc
Elapsed time is 0.252382 seconds.

-------------------------------------------------------------------------
After
-------------------------------------------------------------------------
octave:27> tic; xt = fread (fid, [1000, 60], 'single'); toc
Elapsed time is 0.00123215 seconds.

octave:34> tic; xt = fread (fid, [1000, 60], 'single', 4); toc
Elapsed time is 0.110174 seconds.


It is still the case that turning on 'skip' is approximately 100X slower
(0.110 vs. .0012).  Maybe the next low-hanging optimization would be to just
read SKIP bytes from 'is' and discard them rather than using fseek itself.  It
would require benchmarking.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54100>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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