[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow
From: |
Dan Sebald |
Subject: |
[Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow |
Date: |
Tue, 29 Aug 2017 17:52:05 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
Follow-up Comment #6, bug #51871 (project octave):
OK, nice work. A bit much for me to follow right now, but I just wanted to
note some coding nuances. In this hunk:
+ // Error during conversion.
+ if (str_chunk.size () == 2 &&
+ std::tolower (str_chunk[0]) == 'n' &&
+ std::tolower (str_chunk[1]) == 'a')
+ {
+ // It is Octave NA.
+ val = octave::numeric_limits<T>::NA ();
+ }
would it be more efficient (since speed for large data is important) to not
use std::tolower(), which I assume is a function call (is it a library
function, or does the C++ header for the library know to use an inline?). The
function call will take extra time for the stack/jump/return. The ::tolower
has to do some tests for range and then subtract a value (unless it is going
to use some internal 2^8-length lookup table for speed).
Plus, I'm wondering if the str_chunk.size() is extraneous because what affects
the size value is str_chunk[0] == '\0', str_chunk[1] == '\0' or str_chunk[2]
== '\0', which is effectively checked by testing str_chunk[0] being 'n' or
'N'. In other words, the following is equivalent:
+ // Error during conversion.
+ if ((str_chunk[0]) == 'n' || str_chunk[0] == 'N')) &&
+ (str_chunk[1]) == 'a' || str_chunk[1] == 'A')) &&
+ str_chunk[2] == '\0')
+ {
+ // It is Octave NA.
+ val = octave::numeric_limits<T>::NA ();
+ }
_______________________________________________________
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, 2017/08/29
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow,
Dan Sebald <=
- [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
- [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow, Dan Sebald, 2017/08/31