[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow
From: |
count |
Subject: |
[Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow |
Date: |
Tue, 29 Aug 2017 17:00:38 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 |
Follow-up Comment #5, bug #51871 (project octave):
Yeah, some details are omitted, because I think operations on the matrix is
negligible in this case.
Various improvements can be made:
Using the same benchmark as #0
tic; b = load('dat.txt'); toc
Original time (seconds)
3.30725
1) (Function get_mat_data_input_line) retval = ""; change to
retval.erase ();
Run time: 3.25221
2) Reuse tmp_stream in function read_mat_ascii_data (and (1)).
Run time: 2.90416
3) Use std::getline in get_mat_data_input_line (and (1)(2))
Run time: 1.75087
4) Use strtod to do the convertion (and (1)(2)(3)).
Run time: 1.56847
See the patch.
Note that:
3*) By using std::getline, I drop the support of '\r' line ending (Mac OS
Classic).
4*) By use strtod, I break the rule that stop reading at the position where
it is not part of a number. This make Octave function such as sscanf() behave
abnormally. This could be fixed by seekg() the stream, but octave_istrstream
may not support this operation well.
(file #41695)
_______________________________________________________
Additional Item Attachment:
File name: speed-up-load-ascii-v1.patch Size:6 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51871>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51871] load ascii-based numeric file is significantly slow, count, 2017/08/27
- [Octave-bug-tracker] [bug #51871] load ascii-based numeric file is significantly slow, Dan Sebald, 2017/08/29
- [Octave-bug-tracker] [bug #51871] load ascii-based numeric file is significantly slow, count, 2017/08/29
- [Octave-bug-tracker] [bug #51871] load ascii-based numeric file is significantly slow, Dan Sebald, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Rik, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow,
count <=
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Dan Sebald, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Rik, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Dan Sebald, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Dan Sebald, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Rik, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Dan Sebald, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Dan Sebald, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Rik, 2017/08/30
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, count, 2017/08/30
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, count, 2017/08/31