The database version takes 3m while the in-memory version only takes 5s to parse 5,000 modules and create the portable. Maybe there is some optimization could speed up the database version. Like:
- Use in-memory https://www.sqlite.org/inmemorydb.html SQLite then serialize it in the end.
- Use the original in-memory approach to collect the portable then batch insert the records into SQLite database.
- Enable multiple threads database modification by (1) replacing the "retrieve then create" with
UNIQUE table constraint and (2) removing last_insert_rowid().
- Add index for tables.