in

System.Data.SQLite

An open-source, enhanced version of the SQLite database engine for Windows

NGEN/JIT Issue with SQLiteConnectionStringBuilder, Regex.Compile

Last post 02-17-2008 8:35 PM by Sam. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-16-2008 11:01 AM

    • Sam
    • Top 500 Contributor
    • Joined on 02-16-2008
    • Posts 2

    NGEN/JIT Issue with SQLiteConnectionStringBuilder, Regex.Compile

    I recently converted a program to use NGEN at installation time. The program is a .NET 3.5 app. The confusing thing is that even after NGEN, I would get 9 JITted methods! I was looking at the app in Process Explorer. The JIT DLL (mscorjit.dll I think) was also loaded. So I had to figure out what was causing the app to enter JIT compilation.

    I finally examined the function calls in CLRProfiler (free from Microsoft) and discovered that some calls to Regex.Compile were being made! I did have one Regex in the application, but it wasn't compiled and removing it didn't help. I knew that Regex.Compile can invoke the just-in-time compiler. Well, I had changed the program to use SQLiteConnectionStringBuilder to create a couple connection strings.

    SQLiteConnectionStringBuilder was the culprit and it calls into Regex.Compile. Here's my issue/bug: this doesn't really seem necessary and by using Regex.Compile, this can cause 250 KB of extra RAM, and slow startup down a bit. I don't know if this is documented, but it seems like it should be, particularly as SQLite is famous for its speed, and this would cause performance problems.

    I have to say that System.Data.SQLite (I am using the December build) is really a great component/library, and I continue to be impressed by it. Thank you for creating it (I believe it is authored by Robert Simpson). I have posted on it at http://dotnetperls.com/ (my blog), and I think I used the word "awesome."

    Filed under:
  • 02-16-2008 12:05 PM In reply to

    Re: NGEN/JIT Issue with SQLiteConnectionStringBuilder, Regex.Compile

    SQLiteConnectionStringBuilder inherits from DbConnectionStringBuilder, which uses an internal class called DbConnectionOptions in System.Data.Common.  DbConnectionOptions is your real culprit.

    Unfortunately, in order to not use Regex, you'll have to not use anything that inherits from DbConnectionStringBuilder.

  • 02-17-2008 8:35 PM In reply to

    • Sam
    • Top 500 Contributor
    • Joined on 02-16-2008
    • Posts 2

    Re: NGEN/JIT Issue with SQLiteConnectionStringBuilder, Regex.Compile

    Robert, thanks for the quick reply. I understand that the problem is not in S.D.SQLite per se, but I still think this scenario could be more efficient. I filed a bug at Microsoft Connect, explaining the issue. I wasn't able to find any mention of this problem on Google, so part of my motivation for posting here was to provide a reference for any future developers (although I haven't found this to be a popular topic). Thanks again!

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems