(perf): use sqlite transactions, and GC less (#847)

We use sqlite transactions to commit changes into the database, rather
than storing all the data in a list before running one big insert.
Hopefully this gives a noticeable perf boost.

We also add `org-roam-db-gc-threshold`, which shaves time by deferring the garbage collection to the end.
This commit is contained in:
Jethro Kuan
2020-06-19 18:27:14 +08:00
committed by GitHub
parent f16de357a6
commit 408e38f8ba
3 changed files with 88 additions and 83 deletions

View File

@ -45,7 +45,7 @@
(pcase (benchmark-run 1 (org-roam-db-build-cache t))
(`(,time ,gcs ,time-in-gc)
(message "Elapsed time: %fs (%fs in %d GCs)" time time-in-gc gcs)
(expect time :to-be-less-than 100))))
(expect time :to-be-less-than 60))))
(it "builds quickly without change"
(pcase (benchmark-run 1 (org-roam-db-build-cache))
(`(,time ,gcs ,time-in-gc)