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: Thu, 31 Aug 2017 16:28:12 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

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

It would be nice if there were a way to open the file and communicate, at the
time of opening, what the delimiter character was.  This would be an internal
property associated with the stream object itself.  I took a look through some
of the C++ documentation and I couldn't see that this was a possibility.  Of
course, we could add this to a derived class, such as octave_stream.  But the
current functions are using std::istream as an input and it would require
switching to octave_stream through the call hierarchy.

Least good, but maybe okay, would be to have a static variable within
get_mat_data_input_line () which records the delimiter.  For this to work we
would need a way to identify when the std::istream input has changed.  Is
there some unique identifier per stream?

Final thought, Do we need to strip all trailing '\r' or just the first one? 
If we are on a Windows platform, and have used getline to capture the line and
strip the '\n' character, then we only need to strip one '\r' character.  Any
others were not part of the '\r\n' line ending and should probably stay.

Instead of this


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


I think this would work


// Remove tailing '\r'.
if (! retval.empty () && retval.back () == '\r')
  retval.pop_back ();


This would allow lines where '\r' was legitamately in the text at the end of
the line.


    _______________________________________________________

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]