[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Wed Dec 19 00:35:12 CET 2007


SVN commit 750234 by harris:

Committing optimization fix for dms::setFromString(), as submitted by 
Andrew Buck and improved by Luciano Montanaro.

Thanks for the submission, Andrew.  I'm having trouble understanding how 
kstars could be spending so much time in this function.  I don't 
see that it is called by any inner loops.  I noticed that you patched 
against the 3.5.x version of the code (which is why you didn't find 
QString::stripWhiteSpace() in the Qt docs; that function is called 
trimmed() in Qt-4.x).  But even in that version, I only see the 
following calls to setFromString():

KStarsData::processCustomDataLine() [used when initializing custom 
catalogs]
KStarsData::executeScript() [used when parsing a KStars DCOP script]

dmsBox::createDms(), which in turn is called by FocusDialog and 
LocationDialog, in functions that should only be used when those dialogs 
are opened.

Do your gprof results indicate the calling sequence that led to 
execution of setFromString() ?

thanks again, and welcome to kstars development! :)

CCMAIL: kstars-devel at kde.org



 M  +1 -10     dms.cpp   [UTF-8 ENCODING PROBLEMS]


--- trunk/KDE/kdeedu/kstars/kstars/dms.cpp #750233:750234
@@ -60,17 +60,8 @@
     double s(0.0);
     bool checkValue( false ), badEntry( false ), negative( false );
     QString entry = str.trimmed();
+    entry.remove( QRegExp("[hdms'\"° \t\n\r\v\f]") );
 
-    //remove any instances of unit characters.
-    //h, d, m, s, ', ", or the degree symbol (ASCII 176)
-    entry.replace( QRegExp("h"), QString() );
-    entry.replace( QRegExp("d"), QString() );
-    entry.replace( QRegExp("m"), QString() );
-    entry.replace( QRegExp("s"), QString() );
-    entry.replace( QChar(176), QString() );
-    entry.replace( QRegExp("\'"), QString() );
-    entry.replace( QRegExp("\""), QString() );
-
     //Account for localized decimal-point settings
     //QString::toDouble() requires that the decimal symbol is "."
     entry.replace( KGlobal::locale()->decimalSymbol(), "." );


More information about the Kstars-devel mailing list