View Ticket
Not logged in
Ticket Hash: 25d53b48f6f26c523fd8aa9f5be48b43e13e8287
Title: Surprsing amount of time spent in UnsafeNativeMethods.GetSettingsValue
Status: Closed Type: Performance
Severity: Minor Priority: Medium
Subsystem: Connection Resolution: Fixed
Last Modified: 2016-07-08 01:20:56
Version Found In: 1.0.99
User Comments:
anonymous added on 2016-06-22 09:58:27:
While profiling our application I see that we spend a surprising amount of execution time in UnsafeNativeMethods.GetSettingValue. It is even worse if we actually have an xml config file, looks like the xml file is read and parsed every time GetSettingValue is called. 

Perhaps this information could be determined only once and cached instead? Preferably in a way that enables lock free reads. 

I see it primarily when creating new instances of SQLiteConnection and in SQLiteConnection.Open. Open is twice as bad as SQLiteConnection.ctor since it redoes the work twice, once by calling ParseConnectionString and once by calling get_DefaultFlags.

mistachkin added on 2016-06-22 17:29:06:
This looks like a duplicate of [58ed318f2fadb5e0feff], which was fixed.

mistachkin added on 2016-06-22 17:32:34:
The frequently used settings are cached on a per-connection basis.

mistachkin added on 2016-06-22 17:42:59:
Access to the DefaultFlags setting can be disabled using NoDefaultFlags in the
connection string.

Access to the No_SQLiteConnectionNewParser setting can be disabled by setting
the ParseViaFramework property of the connection prior to calling Open();
however, this may be problematic because the alternative connection string
parsing algorithm exposed by the .NET Framework may not be entirely compatible.

mistachkin added on 2016-07-01 22:59:53:
I've attempted to improve this situation with check-in [7d50138407b6992b], now
on trunk.

Could you please test these changes in your environment and tell us if they
improve the performance for your use case?

anonymous added on 2016-07-04 11:52:30:
Your changes improves things a little bit. 

Hadn't noticed No_SQLiteXmlConfigFile before, setting that makes the biggest difference. Sorry about that.