IreneKnapp / direct-sqlite

MIT License
35 stars 54 forks source link

Add a flag for compiling sqlite in Multi-thread mode #83

Open chshersh opened 4 years ago

chshersh commented 4 years ago

According to the official SQLite documentation, one needs to pass the -DSQLITE_THREADSAFE=2 flag, when compiling SQLite, to run it in multi-thread mode. The multi-thread mode improves performance slightly, when each connection is used only by a single thread. This is often a case when using sqlite with some Pool (e.g. from the resource-pool library).

I propose to add a Cabal flag that passes enables multithreading by passing a proper option to cc-options.

sigrlami commented 4 years ago

@chshersh it is possible but what stops you from compiling it in a system and re-use the available systemlib flag? Is there a case when it's combined with other special flags?

chshersh commented 4 years ago

@sigrlami Nothing stops me from doing so 🙂 However, it's more convenient if the library provides this feature out-of-the-box, so people don't need to deal with manual compilation. Of course, I totally understand, that this is a separate feature to implement, test and maintain, and maintainers might not want to do so. Feel free to close the issue, if it doesn't align with the library goals 👍

sigrlami commented 4 years ago

@chshersh it's ok, I'm just trying to understand the use case for a larger audience. I'll keep the issue open and will work on that if more people will be in favor of it or I have free time, should be straightforward implementation.