vlcn-io / cr-sqlite

Convergent, Replicated SQLite. Multi-writer and CRDT support for SQLite
https://vlcn.io
MIT License
2.77k stars 76 forks source link

update `next_db_version` to return what will actually be the next db … #343

Closed tantaman closed 1 year ago

tantaman commented 1 year ago

…version after commit

This also allows us to stop clearing the db version cache and should give us quicker TPS.

tantaman commented 1 year ago

Looks like this improved write TPS by ~15%

The reason is that we no longer need to consult the database at the start of each write transaction as we actively update the cached db_version. If there are two writers each taking turns then we'd lose the perf improvement here. So the perf improvement 15% in single writer scenarios and between 0 and 15% in multi-writer scenarios.