[Mono-bugs] [Bug 490021] New: Performance improvement in SQLiteConvert

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Mar 28 16:20:12 EDT 2009


https://bugzilla.novell.com/show_bug.cgi?id=490021


           Summary: Performance improvement in SQLiteConvert
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Mono.Data.Sqlite
        AssignedTo: mhabersack at novell.com
        ReportedBy: bertrand.lorentz at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The associations between type names and the corresponding DbType are currently
stored in a static array.
Each time the TypeNameToDbType method is called, it goes through this array,
doing a string comparison on potentially all 43 elements.
I'll post a patch that replaces the array with a Dictionary, for more efficient
lookups.

Here's what I get by running banshee SVN trunk with mono --profile :

Before the patch
Time(ms) Count   P/call(ms) Method name
########################
 690.002    1608    0.429  
Mono.Data.Sqlite.SqliteConvert::TypeNameToDbType(string)
  Callers (with count) that contribute at least for 1%:
        1472  91 % Mono.Data.Sqlite.SqliteDataReader::GetSqliteType(int)
         136   8 %
Mono.Data.Sqlite.SqliteConvert::ColumnToType(SqliteStatement,int)
<snip>
########################
 681.777   24400    0.028  
System.String::Compare(string,int,string,int,int,bool,CultureInfo)
  Callers (with count) that contribute at least for 1%:
       24400  100 % Mono.Data.Sqlite.SqliteConvert::TypeNameToDbType(string)


After applying the patch :
########################
   5.496    1608    0.003  
Mono.Data.Sqlite.SqliteConvert::TypeNameToDbType(string)
  Callers (with count) that contribute at least for 1%:
        1472  91 % Mono.Data.Sqlite.SqliteDataReader::GetSqliteType(int)
         136   8 %
Mono.Data.Sqlite.SqliteConvert::ColumnToType(SqliteStatement,int)
<snip>
########################
   3.852    1608    0.002  
System.Collections.Generic.Dictionary`2::TryGetValue(string,DbType&)
  Callers (with count) that contribute at least for 1%:
        1608  100 % Mono.Data.Sqlite.SqliteConvert::TypeNameToDbType(string)

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list