ChipworkX slow when performing several SQLite insert statements in a row

I am using the ChipworkX with SQLite (database on SD card) and I wanted to share something I discovered that was very helpful when working with SQLite databases.

When saving data for an operation I had several insert statements to process. Sometimes as many as 18-20. This was taking close to a second for each statement so the delay was becoming unbearable (almost 20 seconds). If you simply wrap all the statements in a “Begin Transaction” and “Commit” then it took about 2 seconds to process all of the insert statements.

Makes sense. It has to do with maintaining the integrity of the database. As the database is being updated, it has to be protected in case of a power loss or other problem. This is a bit of an overhead. With the use of transactions, the overhead processing is significantly less.