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

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

[Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow


From: Rik
Subject: [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow
Date: Wed, 30 Aug 2017 13:38:36 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #13, bug #51871 (project octave):

The use of a constant, ASCIIDELIM, might be nice practice.  However, I'm not
sure it needs to contain anything other than space and tab.  See
http://www.mathworks.com/help/matlab/ref/save.html where it appears that those
are the only two delimiters allowed.

I don't think the scanning overhead is as large as you imply.  But there is a
potential modification that might help.

As long as strtod ignores '\r' characters then we don't actually need to
remove them from the string.  That would save a bit.  So I tried commenting
out


+      // Remove tailing '\r'.
+      while (retval.size () && retval.back () == '\r')
+        retval.pop_back ();


and then adding '\r' to the list of characters to ignore


+      // Detect non-whitespace.
+      no_data_found = (retval.find_first_not_of (" \t\r") ==
std::string::npos);


There was some bouncing around in the benchmarks, but it seem to save just 10
milliseconds which on the benchmark I was using was 0.6%.  So, not a whole
lot, but maybe worth it.

Big problem is still failing sscanf, dlmread, and importdata tests in BIST
which are probably related to the position of the stream when a read fails.


    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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