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: Dan Sebald
Subject: [Octave-bug-tracker] [bug #54100] fread using SKIP larger than zero is extremely slow
Date: Fri, 20 Jul 2018 14:02:16 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #11, bug #54100 (project octave):

OK, well


                else
                  seek (skip, SEEK_CUR);


probably isn't as fast as I imagined.  You'd think the C compiler would know
enough to simply advance the pointer rather to actually seek around on the
disk for an area.  (But the compiler may just be using some low-level I/O.) 
In any case, a good test would be to take

skip != 0

out of the test and then feed in a value of 


tic; xt = fread (fid, [1000, 60], 'single', 0); toc


I suppose it could be the use of


                off_t orig_pos = tell ();


as well.  That position could be computed (kind of a pain), but I think the
better way to go is to simply let the C function deal with running out of data
(some error flags should be set, just check those after the fact).  That would
avoid the use of tell().  

It would be good to know exactly what routine is causing the slow down, the
tell() or the seek().  If it were a simple case of reading X bytes, that's
fine, but that means creating a memory space to hold those bytes.

    _______________________________________________________

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]