[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Peter Kümmel syntheticpp at gmx.net
Fri Jan 21 19:17:07 CET 2011


SVN commit 1216173 by kuemmel:

- inline makes no sense when using function pointers
- don't call a function when the pointer is null (~10% faster, ~3% slower if not null)

 M  +5 -5      asciisource.cpp  
 M  +5 -8      asciisource.h  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1216172:1216173
@@ -432,16 +432,16 @@
     return n;
   } else if (_config._columnType == AsciiSourceConfig::Custom) {
     if (_config._columnDelimiter.value().size() == 1) {
-      //MeasureTime t("character");
+      MeasureTime t("character");
       _columnDelimiterCharacter = _config._columnDelimiter.value()[0].toAscii();
       return readColumns(v, buffer, bufstart, bufread, col, s, n, &AsciiSource::isColumnDelimiter);
     } if (_config._columnDelimiter.value().size() > 1) {
-      //MeasureTime t("string");
+      MeasureTime t("string");
       _columnDelimiterString = _config._columnDelimiter.value();
       return readColumns(v, buffer, bufstart, bufread, col, s, n, &AsciiSource::isInColumnDelimiterString);
     }
   } else if (_config._columnType == AsciiSourceConfig::Whitespace) {
-    //MeasureTime t("whitespace");
+    MeasureTime t("whitespace");
     return readColumns(v, buffer, bufstart, bufread, col, s, n, &AsciiSource::isWhiteSpace);
   }
 
@@ -459,7 +459,7 @@
   DelimiterFunction commentDelemiterFunction;
 
   if (_config._delimiters.value().size() == 0) {
-    commentDelemiterFunction = &AsciiSource::noCommentDelimiter;
+    commentDelemiterFunction = 0;
   } else if (_config._delimiters.value().size() == 1) {
     _commentDelimiterCharacter = _config._delimiters.value()[0].toAscii();
     commentDelemiterFunction = &AsciiSource::isCommentDelimiter;
@@ -479,7 +479,7 @@
         break;
       } else if ((this->*columnDelemiterFunction)(buffer[ch])) { //<- check for column start
         incol = false;
-      } else if ((this->*commentDelemiterFunction)(buffer[ch])) {
+      } else if (commentDelemiterFunction && (this->*commentDelemiterFunction)(buffer[ch])) {
         break;
       } else {
         if (!incol) {
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.h #1216172:1216173
@@ -105,33 +105,30 @@
 
     // column delimiter functions
 
-    inline bool isWhiteSpace(char c) { 
+    bool isWhiteSpace(char c) { 
       return isspace((unsigned char)c); 
     }
 
     char _columnDelimiterCharacter;
-    inline bool isColumnDelimiter(char c) {
+    bool isColumnDelimiter(char c) {
       return _columnDelimiterCharacter == c;
     }
 
     QString _columnDelimiterString;
-    inline bool isInColumnDelimiterString(char c) {
+    bool isInColumnDelimiterString(char c) {
       return _columnDelimiterString.contains(c);
     }
 
 
     // comment delimiter functions
 
-    inline bool noCommentDelimiter(char) {
-      return false;
-    }
     char _commentDelimiterCharacter;
-    inline bool isCommentDelimiter(char c) {
+    bool isCommentDelimiter(char c) {
       return _commentDelimiterCharacter == c;
     }
 
     QString _commentDelimiterString;
-    inline bool isInCommentDelimiterString(char c) {
+    bool isInCommentDelimiterString(char c) {
       return _commentDelimiterString.contains(c);
     }
 


More information about the Kst mailing list