Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Data.Sqlite: Performance Testing #13829

Closed
bricelam opened this issue Aug 31, 2017 · 7 comments
Closed

Microsoft.Data.Sqlite: Performance Testing #13829

bricelam opened this issue Aug 31, 2017 · 7 comments
Labels
area-adonet-sqlite area-test closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.

Comments

@bricelam
Copy link
Contributor

While we've been conscious of performance during development, we've also avoided making any (premature) optimizations that would compromise the simplicity of the code base.

It would be good to do some profiling and see if there are any easy wins.

Even if we don't make any improvements, it would also be good to establish a baseline so regressions an be avoided in the future.

@ajcvickers
Copy link
Contributor

@smitpatel How much work would it be run the EF perf tests using the SQLite provider?

@smitpatel
Copy link
Contributor

It should be easy as changing provider registration

@bricelam
Copy link
Contributor Author

bricelam commented Sep 1, 2017

That's probably sufficient to catch significant regressions. Filed #9681. We should keep this on the backlog to actually optimize it someday.

@bricelam
Copy link
Contributor Author

bricelam commented Feb 9, 2018

cc @sebastienros

@buybackoff
Copy link

RE: Performance

There is missing low-level layer that repeats and publicly exposes SQLite API in a "safe as in .NET's unsafe" manner, i.e. pointers, span, etc. wrapped as safe handles, but API is not crafted for ADO.NET (as of now) but allows for low-level fast access without DbDataReader on every call and other allocations such as Queue of statements for every query, boxing for parameters bind, etc. I had to write my own low-level layer based on this library because the current design just so wasteful for calling a very hot query that is prepared and reused forever during application lifetime. Interesting thing is that you already have all the low-level parts, they are just hidden in implementation of ADO.NET stuff.

Simple "SELECT ?X;" query is 2.3x faster as prepared one with binding ?X to a counter value in a loop. Just SELECT 42; is also faster by c.30%.
https://github.com/Spreads/Spreads.SQLite/blob/a9edcd70b4afad87b1d61e09ee2c4c673dc29a0b/src/Spreads.SQLite/Fast/FastQuery.cs

As for connection pooling and automating re-creation of prepared statements (#518) in the current design, it all could be done at application level via some generic object pool. E.g. I added a pool here but there is no reason for it to be in this library. I always need to configure connections with a number of pragmas and had to add a virtual InitConnection method to the pool, which already means that I have to derive the pool in my apps and use separate pools for different use cases. Instead a helper method in an app or a factory lambda in a generic object pool could do all this.

@ajcvickers ajcvickers transferred this issue from aspnet/Microsoft.Data.Sqlite Oct 31, 2018
@ajcvickers ajcvickers added this to the Backlog milestone Oct 31, 2018
@ajcvickers ajcvickers changed the title Performance Testing Microsoft.Data.Sqlite: Performance Testing Oct 31, 2018
@bricelam
Copy link
Contributor Author

@buybackoff It sounds like you're looking for the SQLitePCL.raw API. We build on top of this, and you can always drop down to it using SqliteConnection.Handle or SqliteDataReader.Handle.

@bricelam
Copy link
Contributor Author

bricelam commented Nov 29, 2018

We can probably close this issue. I think our biggest wins will come from things we're tracking in other issues:

@divega divega removed this from the Backlog milestone Nov 30, 2018
@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Mar 10, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-adonet-sqlite area-test closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.
Projects
None yet
Development

No branches or pull requests

5 participants