Performance enhancements in fp loading, string cmp, etc.
Knocks about 1/3 off the first footprint load, and more than 1/2 off subsequent loads.
This commit is contained in:
+17
-22
@@ -242,55 +242,50 @@ int StrNumCmp( const wxString& aString1, const wxString& aString2, int aLength,
|
||||
|
||||
wxString::const_iterator str1 = aString1.begin(), str2 = aString2.begin();
|
||||
|
||||
if( ( str1 == aString1.end() ) || ( str2 == aString2.end() ) )
|
||||
return 0;
|
||||
|
||||
for( i = 0; i < aLength; i++ )
|
||||
{
|
||||
if( isdigit( *str1 ) && isdigit( *str2 ) ) /* digit found */
|
||||
wxUniChar c1 = *str1;
|
||||
wxUniChar c2 = *str2;
|
||||
|
||||
if( isdigit( c1 ) && isdigit( c2 ) ) /* digit found */
|
||||
{
|
||||
nb1 = 0;
|
||||
nb2 = 0;
|
||||
|
||||
while( isdigit( *str1 ) )
|
||||
while( isdigit( c1 ) )
|
||||
{
|
||||
nb1 = nb1 * 10 + (int) *str1 - '0';
|
||||
++str1;
|
||||
nb1 = nb1 * 10 + (int) c1 - '0';
|
||||
c1 = *(++str1);
|
||||
}
|
||||
|
||||
while( isdigit( *str2 ) )
|
||||
while( isdigit( c2 ) )
|
||||
{
|
||||
nb2 = nb2 * 10 + (int) *str2 - '0';
|
||||
++str2;
|
||||
nb2 = nb2 * 10 + (int) c2 - '0';
|
||||
c2 = *(++str2);
|
||||
}
|
||||
|
||||
if( nb1 < nb2 )
|
||||
return -1;
|
||||
|
||||
if( nb1 > nb2 )
|
||||
else if( nb1 > nb2 )
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( aIgnoreCase )
|
||||
{
|
||||
if( toupper( *str1 ) < toupper( *str2 ) )
|
||||
if( toupper( c1 ) < toupper(c2 ) )
|
||||
return -1;
|
||||
|
||||
if( toupper( *str1 ) > toupper( *str2 ) )
|
||||
else if( toupper( c1 ) > toupper( c2 ) )
|
||||
return 1;
|
||||
|
||||
if( ( *str1 == 0 ) && ( *str2 == 0 ) )
|
||||
else if( ( c1 == 0 ) && ( c2 == 0 ) )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( *str1 < *str2 )
|
||||
if( c1 < c2 )
|
||||
return -1;
|
||||
|
||||
if( *str1 > *str2 )
|
||||
else if( c1 > c2 )
|
||||
return 1;
|
||||
|
||||
if( ( str1 == aString1.end() ) && ( str2 == aString2.end() ) )
|
||||
else if( ( c1 == 0 ) && ( c2 == 0 ) )
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user