mirror of
https://github.com/org-roam/org-roam
synced 2025-09-14 15:46:48 -05:00
speed up org-roam-db-sync by wrapping db activity in a transaction (#1495)
In my case of testing with 8253 zettels (available on request if anyone wants to test with them), this improves cleanup speed by 6x and update speed by 2x. Improvements will be smaller for smaller batches as this really just removes the transaction overhead.
This commit is contained in:
@@ -435,18 +435,19 @@ If FORCE, force a rebuild of the cache from scratch."
|
|||||||
contents-hash)
|
contents-hash)
|
||||||
(push file modified-files)))
|
(push file modified-files)))
|
||||||
(remhash file current-files))
|
(remhash file current-files))
|
||||||
(if (fboundp 'dolist-with-progress-reporter)
|
(emacsql-with-transaction (org-roam-db)
|
||||||
(dolist-with-progress-reporter (file (hash-table-keys current-files))
|
(if (fboundp 'dolist-with-progress-reporter)
|
||||||
"Clearing removed files..."
|
(dolist-with-progress-reporter (file (hash-table-keys current-files))
|
||||||
(org-roam-db-clear-file file))
|
"Clearing removed files..."
|
||||||
(dolist (file (hash-table-keys current-files))
|
(org-roam-db-clear-file file))
|
||||||
(org-roam-db-clear-file file)))
|
(dolist (file (hash-table-keys current-files))
|
||||||
(if (fboundp 'dolist-with-progress-reporter)
|
(org-roam-db-clear-file file)))
|
||||||
(dolist-with-progress-reporter (file modified-files)
|
(if (fboundp 'dolist-with-progress-reporter)
|
||||||
"Processing modified files..."
|
(dolist-with-progress-reporter (file modified-files)
|
||||||
(org-roam-db-update-file file))
|
"Processing modified files..."
|
||||||
(dolist (file modified-files)
|
(org-roam-db-update-file file))
|
||||||
(org-roam-db-update-file file)))))
|
(dolist (file modified-files)
|
||||||
|
(org-roam-db-update-file file))))))
|
||||||
|
|
||||||
(defun org-roam-db-update-file (&optional file-path)
|
(defun org-roam-db-update-file (&optional file-path)
|
||||||
"Update Org-roam cache for FILE-PATH.
|
"Update Org-roam cache for FILE-PATH.
|
||||||
|
Reference in New Issue
Block a user