Version: current SVN (using KDE KDE 3.5.5) Installed from: Gentoo Packages OS: Linux Apparently after last changes in collection db, 'quick search' (filter above collection tree) become very slow, practically unusable for, say, ~200 albums collection. ___________ With SQLite, the search in the collection browser was case-sensitive with UTF-8. Patch by Stanislav Nikolov <stanley_87@mail.ru>. (BR 138482)
Stanislav, any ideas on this one?
Created attachment 18832 [details] speed improvement Yes, I guess the previos itreration of the patch was a bit slowish. I think this brings it in much better form. Please test.
SVN commit 611322 by markey: Possible fix for collection search performance issue. BUG: 138501 M +11 -12 collectiondb.cpp --- trunk/extragear/multimedia/amarok/src/collectiondb.cpp #611321:611322 @@ -8,6 +8,7 @@ // (c) 2006 Jonas Hurrelmann <j@outpo.st> // (c) 2006 Shane King <kde@dontletsstart.com> // (c) 2006 Peter C. Ndikuwera <pndiku@gmail.com> +// (c) 2006 Stanislav Nikolov <valsinats@gmail.com> // See COPYING file for licensing information. #define DEBUG_PREFIX "CollectionDB" @@ -6200,20 +6201,18 @@ QString pattern = QString::fromUtf8( (const char*)zA ); QString text = QString::fromUtf8( (const char*)zB ); - pattern = QRegExp::escape( pattern ); + int begin = pattern.startsWith( "%" ), end = pattern.endsWith( "%" ); + pattern = pattern.mid( 1, pattern.length() - 2 ); + if( argc == 3 ) // The function is given an escape character. In likeCondition() it defaults to '/' + pattern.replace( "/%", "%" ).replace( "/_", "_" ).replace( "//", "/" ); - if ( pattern.startsWith("%") ) pattern = ".*" + pattern.mid(1); - if ( pattern.endsWith("%") ) pattern = pattern.left( pattern.length() - 1 ) + ".*"; + int result = 0; + if ( begin && end ) result = ( text.find( pattern, 0, 0 ) != -1); + else if ( begin ) result = text.startsWith( pattern, 0 ); + else if ( end ) result = text.endsWith( pattern, 0 ); + else result = ( text.lower() == pattern.lower() ); - if( argc == 3 ) { - const unsigned char *zEsc = sqlite3_value_text( argv[2] ); - QChar escape = QString::fromUtf8( (const char*)zEsc ).at( 0 ); - pattern.replace( escape + '%', "%" ).replace( escape + '_', "_" ).replace( escape + '/', "/" ); - } - - const QRegExp rx( pattern, 0 /* case-sensitive */, 0 /* simple wildcards */ ); - - sqlite3_result_int( context, rx.search( text ) != -1 ); + sqlite3_result_int( context, result ); } //////////////////////////////////////////////////////////////////////////////////////////
The fix works for me. Thanks!