xaya / libxayagame

MIT License
21 stars 20 forks source link

Wrap catching-up operations in SQLite transactions #16

Closed domob1812 closed 6 years ago

domob1812 commented 6 years ago

Syncing from scratch with SQLiteStorage on disk (not in memory) is very slow. This is presumably caused (at least in part) by the need to synchronise changes to disk for each committed transaction.

Instead of doing one transaction per block (which is the default mode of operation for Game), we could batch many blocks together while catching up. This would allow faster operations in the SQLite database (and in fact also for non-SQLite storages that may have a similar issue), at the cost of losing more data when a failure happens. (But that would just mean that more blocks have to be resynchronised after a restart.)