Hi,
I'm having some performance issues and I'm wondering what I can do about them.
I've profiled my application while loading a single large data set which inserts 639k rows in a table.
The profile hierarchy is mostly:
Document.instantiate() 48.84 s
MutablePersistableRecord.save(_:) 43.73 s
SQLite 13.96 s
So it seems quite some time is spend in GRDB itself.
Is my assumption correct?
If so, is there a way I can reduce the overhead of GRDB?
One function that seems to take quite some share of time is MutablePersistableRecord.primaryKey(_:) with 10.90 s.
Thanks in advance.
Kind regards,
Remco Poelstra
Hello @remcopoelstra,
639k rows is a lot.
Make sure you perform all your changes in a single transaction. That's key for SQLite performance.
If you want to discuss more, please open a GitHub issue, and provide enough information. A small and focused reproducible case would be great. Add detailed profiling information. And your own initial analysis of what could be eventually improved in the library. Thank you!
2 Likes
Also, mind that development builds are slowed down by the liberal use of assertions. Performance tests are only relevant in the release configuration.
2 Likes