mirror of
https://github.com/org-roam/org-roam
synced 2025-09-28 16:50:58 -05:00
optimize(core) linear->constant time filter-fn (#1876)
in org-roam-node-read, there is no need to check filter-fn for each node, move the branch up, O(n) to O(1)
This commit is contained in:
@@ -441,8 +441,10 @@ SORT-FN is a function to sort nodes. See `org-roam-node-read-sort-by-file-mtime'
|
||||
for an example sort function.
|
||||
If REQUIRE-MATCH, the minibuffer prompt will require a match."
|
||||
(let* ((nodes (org-roam-node-read--completions))
|
||||
(nodes (cl-remove-if-not (lambda (n)
|
||||
(if filter-fn (funcall filter-fn (cdr n)) t)) nodes))
|
||||
(nodes (if filter-fn
|
||||
(cl-remove-if-not
|
||||
(lambda (n) (funcall filter-fn (cdr n)) t))
|
||||
nodes))
|
||||
(sort-fn (or sort-fn
|
||||
(when org-roam-node-default-sort
|
||||
(intern (concat "org-roam-node-read-sort-by-"
|
||||
|
Reference in New Issue
Block a user