> Indeed turning off memstatus leads to a 500% (from ~3s to ~0.5s) performance increase. > Changing the threading mode or the indirection level of the mutexes calls seems to have no significant effect.
That is quite significant. Looking at the code, it seems the mutex requirement is mostly for the soft heap limit, maybe there could be a way to use atomic instruction to maintain the stats ? The highwater stat could be handled by a CAS (loop), and this should make the memstatus data cheaper overall when soft heap limit is not required. (my use case involved a hundreds of independent SQLite databases from a single process, I have not benchmarked yet, but I am probably hitting that mutex hard as well) Eric Le ven. 3 janv. 2020 à 17:36, Keith Medcalf <kmedc...@dessus.com> a écrit : > On Friday, 3 January, 2020 09:30, sky5w...@gmail.com wrote: > > >I get SQLITE_MISUSE when attempting > >sqlite3_config(SQLITE_CONFIG_MEMSTATUS, 0); > >immediately after opening a db connection? > >My connection has THREADSAFE = 1. > > That is correct. You must configure the library before it is initialized, > not after. > > https://sqlite.org/c3ref/config.html > > -- > The fact that there's a Highway to Hell but only a Stairway to Heaven says > a lot about anticipated traffic volume. > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users