(feat): remove all symlink resolutions (#1109)

file-truename calls alone accounts for over 20% of CPU samples in org-roam-db-build-cache. It's expensive and unnecessary. To get an absolute path, expand-file-name alone is enough.

Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
Kisaragi Hiu
2020-09-19 17:12:08 +09:00
committed by GitHub
parent 925d225f13
commit b2aa8bdad0
5 changed files with 44 additions and 45 deletions

View File

@@ -110,9 +110,9 @@ For example: (setq org-roam-buffer-window-parameters '((no-other-window . t)))"
(defun org-roam-buffer--insert-title ()
"Insert the org-roam-buffer title."
(insert (propertize (org-roam--get-title-or-slug
(file-truename (buffer-file-name org-roam-buffer--current)))
'font-lock-face
'org-document-title)))
(buffer-file-name org-roam-buffer--current))
'font-lock-face
'org-document-title)))
(defun org-roam-buffer--pluralize (string number)
"Conditionally pluralize STRING if NUMBER is above 1."
@@ -152,7 +152,7 @@ For example: (setq org-roam-buffer-window-parameters '((no-other-window . t)))"
(defun org-roam-buffer--insert-backlinks ()
"Insert the org-roam-buffer backlinks string for the current buffer."
(if-let* ((file-path (file-truename (buffer-file-name org-roam-buffer--current)))
(if-let* ((file-path (buffer-file-name org-roam-buffer--current))
(titles (with-current-buffer org-roam-buffer--current
(org-roam--extract-titles)))
(backlinks (org-roam--get-backlinks (push file-path titles)))