My program calculates a next state based on current state and an increment. Calculation is a breadth first search graph exploration spanning 100-1000 explored nodes.
So far I've had a separate datastructure for traversal (because if initial incompetence regarding SQLite), but now would like to use an in-memory SQLite database for the state (because keeping dual datastructures in sync has proven to be hell, and competence regarding SQLite has somewhat improved; in particular the WITH RECURSIVE statement was an eye-opener).
For my previous data structure I could easily make copies of the state and put in the explored graph nodes, but for SQLite this does not seem as easy or lightweight. Here are the options I imagine might work:
- serialize/deserialize
- Works pretty much like my old data structure. However memory is already an issue, and the complete database is unlikely smaller than the separate structure.
- Initial testing suggests ActiveTcl distro does not compile sqlite3 with serialization support enabled.
- record, rollback, replay
- Recording the transactions from initial state (e.g. using
trace execution
) to node and then replay later, this is probably much more efficient than 1. How to actually record is percieved as risky (see a previous question of mine), so any advice is appreciated.
- Recording the transactions from initial state (e.g. using
Before setting out for a week long adventure in futility, I'm posting this question in hopes of someone else having experience of branching an SQLite database.