mclear-tools / consult-notes

Use consult to search notes
GNU General Public License v3.0
164 stars 15 forks source link

consult-notes-org-roam-mode slows down org-roam-node-find from 0.2s to 3s #18

Closed ParetoOptimalDev closed 1 year ago

ParetoOptimalDev commented 1 year ago

This is for 3200~ nodes with vertico/orderless/corfu/marginalia.

I need to delete a lot of my nodes, but this prevents me from being able to use this package until I do that.

Not sure if there's some low-hanging fruit here.

cpu profile ``` 1446 80% - command-execute 830 46% - byte-code 830 46% - read-extended-command 830 46% - read-extended-command-1 830 46% - completing-read-default 830 46% - apply 830 46% - vertico--advice 801 44% - # 724 40% - vertico--exhibit 694 38% - vertico--update 649 36% - vertico--recompute 623 34% - vertico--all-completions 623 34% - completion-all-completions 623 34% - apply 623 34% - # 623 34% - completion--nth-completion 623 34% - completion--some 623 34% - # 623 34% - orderless-all-completions 623 34% - orderless-filter 622 34% - # 622 34% - complete-with-action 126 7% - all-completions 65 3% - # 53 2% - # 2 0% - commandp 2 0% - interactive-form 2 0% - oclosure-interactive-form 1 0% apply 1 0% - # 1 0% complete-with-action 14 0% - vertico-sort-history-length-alpha 10 0% # 44 2% redisplay 1 0% - vertico--metadata-get 1 0% - completion-metadata-get 1 0% apply 15 0% - vertico--arrange-candidates 14 0% - vertico--affixate 14 0% - # 14 0% - apply 14 0% - marginalia--affixate 14 0% - marginalia--cached 14 0% - marginalia-annotate-command 11 0% - marginalia--function-doc 11 0% - documentation 6 0% substitute-command-keys 1 0% vertico--format-candidate 12 0% - vertico--display-candidates 1 0% - vertico--resize-window 1 0% - window-resize 1 0% - window--resize-mini-window 1 0% window-min-size 3 0% vertico--display-count 2 0% - minibuffer-inactive-mode 2 0% - run-mode-hooks 2 0% - run-hooks 1 0% - global-font-lock-mode-enable-in-buffers 1 0% - turn-on-font-lock-if-desired 1 0% turn-on-font-lock 1 0% magit-auto-revert-mode-enable-in-buffers 1 0% - frame-windows-min-size 1 0% - window-min-size 1 0% window--min-size-1 1 0% - window--resize-root-window-vertically 1 0% - window-sizable 1 0% - window-min-size 1 0% - window--min-size-1 1 0% - window-size-fixed-p 1 0% window--size-fixed-1 1 0% blink-cursor-end 1 0% - timer-event-handler 1 0% - apply 1 0% - blink-cursor-start 1 0% - blink-cursor--start-timer 1 0% - run-with-timer 1 0% run-at-time 616 34% - funcall-interactively 616 34% - execute-extended-command 616 34% - command-execute 616 34% - funcall-interactively 612 34% - org-roam-node-find 612 34% - org-roam-node-read 612 34% - apply 612 34% - consult-org-roam-node-read 612 34% - let* 605 33% - org-roam-node-read--completions 555 31% - # 553 30% - org-roam-node-read--to-candidate 552 30% - org-roam-node--format-entry 551 30% - org-roam-format-template 533 29% - replace-regexp-in-string 528 29% - # 491 27% - # 361 20% - org-roam-node-blinks 361 20% - apply 360 20% - # 318 17% - org-roam-db-query 277 15% - emacsql 277 15% - apply 277 15% - # 140 7% - emacsql-wait 140 7% - apply 138 7% - # 60 3% - emacsql-waiting-p 59 3% - apply 20 1% - # 20 1% - emacsql-buffer 19 1% - apply 19 1% - # 19 1% - emacsql-process 19 1% - apply 19 1% - # 15 0% - slot-boundp 11 0% - eieio-oref 11 0% - apply 11 0% - eieio-oref--closql-oref 8 0% - closql--closql-object-p 8 0% - closql-object--eieio-childp 6 0% - object-of-class-p 4 0% child-of-class-p 4 0% - eieio-oref 4 0% - apply 4 0% - eieio-oref--closql-oref 4 0% - closql--closql-object-p 3 0% - closql-object--eieio-childp 3 0% object-of-class-p 3 0% accept-process-output 3 0% - emacsql-process 3 0% - apply 3 0% - # 2 0% - slot-boundp 1 0% - eieio-oref 1 0% - apply 1 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% object-of-class-p 1 0% - eieio-oref 1 0% - apply 1 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% - object-of-class-p 1 0% child-of-class-p 1 0% # 65 3% - apply 65 3% - emacsql-compile 57 3% - emacsql-format 32 1% - emacsql-escape-scalar 20 1% - emacsql-quote-scalar 16 0% - # 3 0% kill-buffer 5 0% - emacsql-types 5 0% - apply 5 0% - # 5 0% - slot-value 5 0% - apply 4 0% - eieio-oref--closql-oref 2 0% - # 1 0% eieio--slot-name-index 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% - object-of-class-p 1 0% child-of-class-p 1 0% - emacsql-prepare 1 0% - emacsql-prepare--sexp 1 0% - emacsql--*expr 1 0% - # 1 0% - emacsql--*expr 1 0% - emacsql--!param 1 0% emacsql-escape-scalar 33 1% - emacsql-parse 33 1% - apply 14 0% - # 12 0% - emacsql-buffer 12 0% - apply 12 0% - # 12 0% - emacsql-process 12 0% - apply 12 0% - # 6 0% - eieio-oref 6 0% - apply 6 0% - eieio-oref--closql-oref 2 0% - closql--closql-object-p 1 0% closql-object--eieio-childp 1 0% # 6 0% - slot-boundp 3 0% - eieio-oref 3 0% - apply 3 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% object-of-class-p 22 1% - emacsql-send-message 22 1% - apply 20 1% - # 20 1% - apply 13 0% - # 3 0% - emacsql-process 3 0% - apply 3 0% - # 3 0% - eieio-oref 3 0% - apply 3 0% eieio-oref--closql-oref 6 0% - # 6 0% - emacsql-log 5 0% - apply 4 0% - # 4 0% - emacsql-log-buffer 4 0% - apply 4 0% - # 1 0% - eieio-oref 1 0% - apply 1 0% eieio-oref--closql-oref 1 0% - slot-boundp 1 0% - eieio-oref 1 0% - apply 1 0% eieio-oref--closql-oref 15 0% - emacsql-clear 15 0% - apply 11 0% - # 8 0% - emacsql-buffer 8 0% - apply 7 0% - # 7 0% - emacsql-process 7 0% - apply 7 0% - # 4 0% - slot-boundp 3 0% - eieio-oref 3 0% - apply 2 0% - eieio-oref--closql-oref 2 0% - closql--closql-object-p 2 0% - closql-object--eieio-childp 2 0% object-of-class-p 3 0% - eieio-oref 3 0% - apply 3 0% - eieio-oref--closql-oref 2 0% - closql--closql-object-p 2 0% - closql-object--eieio-childp 2 0% - object-of-class-p 2 0% child-of-class-p 2 0% erase-buffer 40 2% - org-roam-db 8 0% - emacsql-live-p 8 0% - apply 8 0% - # 8 0% - emacsql-process 7 0% - apply 7 0% - # 5 0% - eieio-oref 5 0% - apply 5 0% - eieio-oref--closql-oref 4 0% - closql--closql-object-p 4 0% - closql-object--eieio-childp 4 0% object-of-class-p 1 0% - slot-boundp 1 0% - eieio-oref 1 0% - apply 1 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% object-of-class-p 42 2% - org-roam-node-sizes 42 2% - apply 40 2% # 21 1% - org-roam-node-fmtime 20 1% - apply 20 1% - # 14 0% consult-notes--time 21 1% - org-roam-node-dir 18 1% - apply 18 1% # 8 0% mapconcat 3 0% truncate-string-to-width 25 1% - org-roam-node-list 23 1% - org-roam-db-query 22 1% - emacsql 22 1% - apply 22 1% - # 12 0% - emacsql-parse 12 0% - apply 12 0% # 10 0% - emacsql-wait 10 0% - apply 10 0% - # 2 0% accept-process-output 1 0% org-roam-db 1 0% # 25 1% - seq-sort 25 1% - apply 25 1% - # 24 1% sort 7 0% - consult--read 7 0% - consult--read-1 7 0% - consult--with-preview-1 7 0% - # 7 0% - completing-read 7 0% - completing-read-default 7 0% - apply 7 0% - vertico--advice 5 0% - # 1 0% - window--resize-root-window-vertically 1 0% - window-sizable 1 0% window-min-size 337 18% + ... 3 0% + redisplay_internal (C function) 1 0% + timer-event-handler i 1446 80% - command-execute 830 46% - byte-code 830 46% - read-extended-command 830 46% - read-extended-command-1 830 46% - completing-read-default 830 46% - apply 830 46% - vertico--advice 801 44% - # 724 40% - vertico--exhibit 694 38% - vertico--update 649 36% - vertico--recompute 623 34% - vertico--all-completions 623 34% - completion-all-completions 623 34% - apply 623 34% - # 623 34% - completion--nth-completion 623 34% - completion--some 623 34% - # 623 34% - orderless-all-completions 623 34% - orderless-filter 622 34% - # 622 34% - complete-with-action 126 7% - all-completions 65 3% - # 53 2% - # 2 0% - commandp 2 0% - interactive-form 2 0% - oclosure-interactive-form 1 0% apply 1 0% - # 1 0% complete-with-action 14 0% - vertico-sort-history-length-alpha 10 0% # 44 2% redisplay 1 0% - vertico--metadata-get 1 0% - completion-metadata-get 1 0% apply 15 0% - vertico--arrange-candidates 14 0% - vertico--affixate 14 0% - # 14 0% - apply 14 0% - marginalia--affixate 14 0% - marginalia--cached 14 0% - marginalia-annotate-command 11 0% - marginalia--function-doc 11 0% - documentation 6 0% substitute-command-keys 1 0% vertico--format-candidate 12 0% - vertico--display-candidates 1 0% - vertico--resize-window 1 0% - window-resize 1 0% - window--resize-mini-window 1 0% window-min-size 3 0% vertico--display-count 2 0% - minibuffer-inactive-mode 2 0% - run-mode-hooks 2 0% - run-hooks 1 0% - global-font-lock-mode-enable-in-buffers 1 0% - turn-on-font-lock-if-desired 1 0% turn-on-font-lock 1 0% magit-auto-revert-mode-enable-in-buffers 1 0% - frame-windows-min-size 1 0% - window-min-size 1 0% window--min-size-1 1 0% - window--resize-root-window-vertically 1 0% - window-sizable 1 0% - window-min-size 1 0% - window--min-size-1 1 0% - window-size-fixed-p 1 0% window--size-fixed-1 1 0% blink-cursor-end 1 0% - timer-event-handler 1 0% - apply 1 0% - blink-cursor-start 1 0% - blink-cursor--start-timer 1 0% - run-with-timer 1 0% run-at-time 616 34% - funcall-interactively 616 34% - execute-extended-command 616 34% - command-execute 616 34% - funcall-interactively 612 34% - org-roam-node-find 612 34% - org-roam-node-read 612 34% - apply 612 34% - consult-org-roam-node-read 612 34% - let* 605 33% - org-roam-node-read--completions 555 31% - # 553 30% - org-roam-node-read--to-candidate 552 30% - org-roam-node--format-entry 551 30% - org-roam-format-template 533 29% - replace-regexp-in-string 528 29% - # 491 27% - # 361 20% - org-roam-node-blinks 361 20% - apply 360 20% - # 318 17% - org-roam-db-query 277 15% - emacsql 277 15% - apply 277 15% - # 140 7% - emacsql-wait 140 7% - apply 138 7% - # 60 3% - emacsql-waiting-p 59 3% - apply 20 1% - # 20 1% - emacsql-buffer 19 1% - apply 19 1% - # 19 1% - emacsql-process 19 1% - apply 19 1% - # 15 0% - slot-boundp 11 0% - eieio-oref 11 0% - apply 11 0% - eieio-oref--closql-oref 8 0% - closql--closql-object-p 8 0% - closql-object--eieio-childp 6 0% - object-of-class-p 4 0% child-of-class-p 4 0% - eieio-oref 4 0% - apply 4 0% - eieio-oref--closql-oref 4 0% - closql--closql-object-p 3 0% - closql-object--eieio-childp 3 0% object-of-class-p 3 0% accept-process-output 3 0% - emacsql-process 3 0% - apply 3 0% - # 2 0% - slot-boundp 1 0% - eieio-oref 1 0% - apply 1 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% object-of-class-p 1 0% - eieio-oref 1 0% - apply 1 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% - object-of-class-p 1 0% child-of-class-p 1 0% # 65 3% - apply 65 3% - emacsql-compile 57 3% - emacsql-format 32 1% - emacsql-escape-scalar 20 1% - emacsql-quote-scalar 16 0% - # 3 0% kill-buffer 5 0% - emacsql-types 5 0% - apply 5 0% - # 5 0% - slot-value 5 0% - apply 4 0% - eieio-oref--closql-oref 2 0% - # 1 0% eieio--slot-name-index 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% - object-of-class-p 1 0% child-of-class-p 1 0% - emacsql-prepare 1 0% - emacsql-prepare--sexp 1 0% - emacsql--*expr 1 0% - # 1 0% - emacsql--*expr 1 0% - emacsql--!param 1 0% emacsql-escape-scalar 33 1% - emacsql-parse 33 1% - apply 14 0% - # 12 0% - emacsql-buffer 12 0% - apply 12 0% - # 12 0% - emacsql-process 12 0% - apply 12 0% - # 6 0% - eieio-oref 6 0% - apply 6 0% - eieio-oref--closql-oref 2 0% - closql--closql-object-p 1 0% closql-object--eieio-childp 1 0% # 6 0% - slot-boundp 3 0% - eieio-oref 3 0% - apply 3 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% object-of-class-p 22 1% - emacsql-send-message 22 1% - apply 20 1% - # 20 1% - apply 13 0% - # 3 0% - emacsql-process 3 0% - apply 3 0% - # 3 0% - eieio-oref 3 0% - apply 3 0% eieio-oref--closql-oref 6 0% - # 6 0% - emacsql-log 5 0% - apply 4 0% - # 4 0% - emacsql-log-buffer 4 0% - apply 4 0% - # 1 0% - eieio-oref 1 0% - apply 1 0% eieio-oref--closql-oref 1 0% - slot-boundp 1 0% - eieio-oref 1 0% - apply 1 0% eieio-oref--closql-oref 15 0% - emacsql-clear 15 0% - apply 11 0% - # 8 0% - emacsql-buffer 8 0% - apply 7 0% - # 7 0% - emacsql-process 7 0% - apply 7 0% - # 4 0% - slot-boundp 3 0% - eieio-oref 3 0% - apply 2 0% - eieio-oref--closql-oref 2 0% - closql--closql-object-p 2 0% - closql-object--eieio-childp 2 0% object-of-class-p 3 0% - eieio-oref 3 0% - apply 3 0% - eieio-oref--closql-oref 2 0% - closql--closql-object-p 2 0% - closql-object--eieio-childp 2 0% - object-of-class-p 2 0% child-of-class-p 2 0% erase-buffer 40 2% - org-roam-db 8 0% - emacsql-live-p 8 0% - apply 8 0% - # 8 0% - emacsql-process 7 0% - apply 7 0% - # 5 0% - eieio-oref 5 0% - apply 5 0% - eieio-oref--closql-oref 4 0% - closql--closql-object-p 4 0% - closql-object--eieio-childp 4 0% object-of-class-p 1 0% - slot-boundp 1 0% - eieio-oref 1 0% - apply 1 0% - eieio-oref--closql-oref 1 0% - closql--closql-object-p 1 0% - closql-object--eieio-childp 1 0% object-of-class-p 42 2% - org-roam-node-sizes 42 2% - apply 40 2% # 21 1% - org-roam-node-fmtime 20 1% - apply 20 1% - # 14 0% consult-notes--time 21 1% - org-roam-node-dir 18 1% - apply 18 1% # 8 0% mapconcat 3 0% truncate-string-to-width 25 1% - org-roam-node-list 23 1% - org-roam-db-query 22 1% - emacsql 22 1% - apply 22 1% - # 12 0% - emacsql-parse 12 0% - apply 12 0% # 10 0% - emacsql-wait 10 0% - apply 10 0% - # 2 0% accept-process-output 1 0% org-roam-db 1 0% # 25 1% - seq-sort 25 1% - apply 25 1% - # 24 1% sort 7 0% - consult--read 7 0% - consult--read-1 7 0% - consult--with-preview-1 7 0% - # 7 0% - completing-read 7 0% - completing-read-default 7 0% - apply 7 0% - vertico--advice 5 0% - # 1 0% - window--resize-root-window-vertically 1 0% - window-sizable 1 0% window-min-size 337 18% + ... 3 0% + redisplay_internal (C function) 1 0% + timer-event-handler ```
mem profile ``` 117,013,987 77% - command-execute 73,207,689 48% - funcall-interactively 73,207,641 48% - execute-extended-command 73,207,513 48% - command-execute 73,207,465 48% - funcall-interactively 69,513,563 45% - org-roam-node-find 69,513,563 45% - org-roam-node-read 69,513,563 45% - apply 69,513,563 45% - consult-org-roam-node-read 69,513,563 45% - let* 69,298,300 45% - org-roam-node-read--completions 50,441,369 33% - # 48,628,337 32% - org-roam-node-read--to-candidate 48,064,753 31% - org-roam-node--format-entry 47,476,305 31% - org-roam-format-template 44,128,729 29% - replace-regexp-in-string 41,343,164 27% - # 35,309,624 23% - # 27,861,436 18% - org-roam-node-blinks 27,861,436 18% - apply 27,861,436 18% - # 24,931,101 16% - org-roam-db-query 23,662,453 15% - emacsql 23,662,453 15% - apply 23,662,453 15% - # 19,251,364 12% - apply 18,818,260 12% - emacsql-compile 18,642,949 12% - emacsql-format 10,507,248 6% - emacsql-escape-scalar 3,021,701 1% - emacsql-quote-scalar 29,008 0% # 2,310 0% beacon--vanish 136,752 0% - emacsql-types 136,752 0% - apply 136,752 0% - # 136,752 0% - slot-value 136,752 0% - apply 136,752 0% eieio-oref--closql-oref 38,559 0% - emacsql-prepare 38,559 0% - emacsql-prepare--sexp 31,567 0% - emacsql--*expr 30,297 0% - # 30,297 0% - emacsql--*expr 30,297 0% - emacsql--!param 1,024 0% emacsql-escape-format 105 0% - emacsql-escape-scalar 105 0% emacsql-quote-scalar 5,210 0% - # 5,210 0% emacsql--!param 1,152 0% emacsql--from-keyword 1,921,689 1% - emacsql-send-message 1,921,689 1% - apply 1,921,689 1% - # 1,921,689 1% - apply 1,619,177 1% - # 261,072 0% - emacsql-process 261,072 0% - apply 261,072 0% - # 157,472 0% - slot-boundp 157,472 0% - eieio-oref 157,472 0% - apply 157,472 0% eieio-oref--closql-oref 103,600 0% - eieio-oref 103,600 0% - apply 103,600 0% eieio-oref--closql-oref 302,512 0% - # 302,512 0% - emacsql-log 302,512 0% - apply 302,512 0% - # 302,512 0% - emacsql-log-buffer 302,512 0% - apply 302,512 0% - # 174,048 0% - slot-boundp 174,048 0% - eieio-oref 174,048 0% - apply 174,048 0% eieio-oref--closql-oref 128,464 0% - eieio-oref 128,464 0% - apply 128,464 0% eieio-oref--closql-oref 1,917,528 1% - emacsql-wait 1,917,528 1% - apply 1,901,568 1% - # 1,031,120 0% - emacsql-waiting-p 1,031,120 0% - apply 857,808 0% - # 857,808 0% - emacsql-buffer 857,808 0% - apply 857,808 0% - # 857,808 0% - emacsql-process 857,808 0% - apply 857,808 0% - # 571,872 0% - slot-boundp 571,872 0% - eieio-oref 571,872 0% - apply 571,872 0% eieio-oref--closql-oref 285,936 0% - eieio-oref 285,936 0% - apply 285,936 0% eieio-oref--closql-oref 261,072 0% accept-process-output 190,624 0% - emacsql-process 190,624 0% - apply 190,624 0% - # 178,192 0% - eieio-oref 178,192 0% - apply 178,192 0% eieio-oref--closql-oref 12,432 0% - slot-boundp 12,432 0% - eieio-oref 12,432 0% - apply 12,432 0% eieio-oref--closql-oref 571,872 0% - emacsql-clear 571,872 0% - apply 571,872 0% - # 314,944 0% - emacsql-buffer 314,944 0% - apply 314,944 0% - # 314,944 0% - emacsql-process 314,944 0% - apply 314,944 0% - # 261,072 0% - slot-boundp 261,072 0% - eieio-oref 261,072 0% - apply 261,072 0% eieio-oref--closql-oref 53,872 0% - eieio-oref 53,872 0% - apply 53,872 0% eieio-oref--closql-oref 1,268,648 0% - org-roam-db 140,896 0% - emacsql-live-p 140,896 0% - apply 140,896 0% - # 140,896 0% - emacsql-process 140,896 0% - apply 140,896 0% - # 116,032 0% - eieio-oref 116,032 0% - apply 116,032 0% eieio-oref--closql-oref 24,864 0% - slot-boundp 24,864 0% - eieio-oref 24,864 0% - apply 24,864 0% eieio-oref--closql-oref 952,768 0% - org-roam-node-fmtime 952,768 0% - apply 952,768 0% - # 867,816 0% - consult-notes--time 3,520 0% consult-notes--time-relative 770,324 0% - org-roam-node-sizes 770,324 0% - apply 770,324 0% # 566,736 0% mapconcat 535,584 0% truncate-string-to-width 336,544 0% - org-roam-node-dir 336,544 0% - apply 336,544 0% # 863,952 0% apply 4,701 0% match-string 16,625,769 10% - org-roam-node-list 16,580,185 10% - org-roam-db-query 16,580,185 10% - emacsql 16,580,185 10% - apply 16,580,185 10% - # 8,394,824 5% - emacsql-wait 8,394,824 5% - apply 8,394,824 5% - # 41,440 0% accept-process-output 8,105,487 5% - emacsql-parse 8,105,487 5% - apply 8,105,487 5% - # 319,088 0% - emacsql-buffer 319,088 0% - apply 319,088 0% - # 319,088 0% - emacsql-process 319,088 0% - apply 319,088 0% - # 174,048 0% - eieio-oref 174,048 0% - apply 174,048 0% eieio-oref--closql-oref 145,040 0% - slot-boundp 145,040 0% - eieio-oref 145,040 0% - apply 145,040 0% eieio-oref--closql-oref 2,538 0% read 79,831 0% - apply 78,439 0% - emacsql-compile 73,239 0% emacsql-format 5,200 0% - emacsql-prepare 3,808 0% - emacsql-prepare--string 1,392 0% replace-regexp-in-string 43 0% - emacsql-send-message 43 0% - apply 43 0% - # 43 0% - apply 43 0% # 45,584 0% # 2,182,510 1% - seq-sort 2,182,510 1% - apply 2,182,510 1% - # 2,134,078 1% - sort 2,310 0% # 11,356 0% - org-roam-node--process-display-format 11,356 0% - org-roam-format-template 10,332 0% - replace-regexp-in-string 10,332 0% - # 2,040 0% # 1,016 0% apply 189,367 0% - consult--read 189,367 0% - consult--read-1 189,367 0% - consult--with-preview-1 189,367 0% - # 189,367 0% - completing-read 189,367 0% - completing-read-default 189,367 0% - apply 189,367 0% - vertico--advice 152,643 0% - # 37,155 0% - vertico--exhibit 34,985 0% - vertico--display-candidates 633 0% - vertico--resize-window 633 0% window-resize 2,170 0% vertico--display-count 8,288 0% marginalia--minibuffer-setup 4,344 0% - timer-event-handler 4,216 0% - apply 4,144 0% - show-paren-function 4,144 0% - show-paren--default 4,144 0% syntax-ppss 72 0% - blink-cursor-start 72 0% - blink-cursor--start-timer 72 0% - run-with-timer 72 0% - run-at-time 24 0% timer-set-time 24 0% - timer-activate 24 0% timer--activate 80 0% timer-inc-time 24 0% - timer-activate 24 0% timer--activate 1,024 0% - consult--preview-post-command 1,024 0% - # 1,024 0% - # 1,024 0% - if 1,024 0% - funcall 1,024 0% - and 1,024 0% - funcall 1,024 0% # 252 0% - redisplay_internal (C function) 252 0% eval 184 0% minibuffer-setup 160 0% - minibuffer-inactive-mode 160 0% - run-mode-hooks 160 0% - run-hooks 160 0% - auto-revert--global-possibly-adopt-current-buffer 160 0% - auto-revert--global-adopt-current-buffer 160 0% - auto-revert-set-timer 160 0% - run-with-timer 160 0% - run-at-time 96 0% - timer-activate 96 0% timer--activate 48 0% timer-set-time 64 0% - minibuffer-mode 64 0% - run-mode-hooks 64 0% - run-hooks 64 0% - auto-revert--global-possibly-adopt-current-buffer 64 0% - auto-revert--global-adopt-current-buffer 64 0% - auto-revert-set-timer 64 0% - run-with-timer 64 0% - run-at-time 24 0% timer-set-time 24 0% - timer-activate 24 0% timer--activate 16 0% command-execute 128 0% - run-at-time 48 0% timer-set-time 48 0% - timer-activate 48 0% timer--activate 48 0% - keyboard-quit 48 0% - apply 48 0% - lsp-ui-doc--hide-frame 48 0% - run-at-time 24 0% timer-set-time 24 0% - timer-activate 24 0% timer--activate 43,806,298 28% - byte-code 43,806,298 28% - read-extended-command 43,806,298 28% - read-extended-command-1 43,806,298 28% - completing-read-default 43,806,298 28% - apply 43,806,298 28% - vertico--advice 43,638,034 28% - # 34,906,124 22% - redisplay_internal (C function) 17,439,432 11% olivetti-set-window 9,072 0% eval 7,374,214 4% - vertico--exhibit 4,809,712 3% - vertico--arrange-candidates 4,364,656 2% - vertico--affixate 4,360,512 2% - # 4,360,512 2% - apply 4,353,168 2% - marginalia--affixate 4,351,136 2% - marginalia--cached 4,337,928 2% - marginalia-annotate-command 2,815,111 1% - marginalia--function-doc 2,723,639 1% - documentation 2,435,264 1% - substitute-command-keys 12,432 0% # 6,144 0% key-valid-p 4,768 0% - describe-map-tree 4,064 0% - describe-map 1,016 0% describe-map--align-section 32,768 0% - marginalia--documentation 24,552 0% - marginalia--truncate 16,368 0% truncate-string-to-width 4,144 0% - vertico--metadata-get 4,144 0% - completion-metadata-get 4,144 0% - apply 4,144 0% marginalia--completion-metadata-get 274,032 0% - vertico--format-candidate 128,352 0% vertico--display-string 38,664 0% - # 30,480 0% orderless-highlight-matches 1,248,238 0% - vertico--update 641,350 0% - vertico--recompute 566,022 0% - vertico--all-completions 566,022 0% - completion-all-completions 566,022 0% - apply 566,022 0% - # 561,878 0% - completion--nth-completion 561,878 0% - completion--some 561,878 0% - # 561,878 0% - orderless-all-completions 561,878 0% - orderless-filter 530,086 0% - # 530,086 0% - complete-with-action 515,750 0% - all-completions 515,750 0% - # 399,102 0% - version-to-list 399,102 0% error 24,576 0% - orderless-pattern-compiler 18,432 0% orderless-regexp 3,072 0% - rx-to-string 3,072 0% - rx--translate 3,072 0% - rx--translate-form 3,072 0% - rx--translate-or 3,072 0% - rx--translate 3,072 0% rx--translate-form 3,072 0% isearch-no-upper-case-p 42,880 0% vertico-sort-history-length-alpha 605,784 0% redisplay 1,238,144 0% - vertico--display-candidates 2,532 0% - vertico--resize-window 2,532 0% window-resize 78,120 0% vertico--display-count 32,192 0% - command-execute 11,000 0% - funcall-interactively 4,240 0% - self-insert-command 4,240 0% - undo-auto--undoable-change 4,240 0% - undo-auto--boundary-ensure-timer 4,240 0% - run-at-time 4,216 0% - timer-activate 4,216 0% timer--activate 24 0% timer-set-time 424 0% - vertico-exit 112 0% vertico-insert 96 0% - delete-backward-char 96 0% - undo-auto--undoable-change 96 0% - undo-auto--boundary-ensure-timer 96 0% - run-at-time 72 0% - timer-activate 72 0% timer--activate 24 0% timer-set-time 20,720 0% marginalia--minibuffer-setup 9,072 0% - minibuffer-inactive-mode 4,928 0% - run-mode-hooks 4,928 0% - run-hooks 4,928 0% - auto-revert--global-possibly-adopt-current-buffer 4,928 0% - auto-revert--global-adopt-current-buffer 4,928 0% - auto-revert-set-timer 4,928 0% - run-with-timer 4,928 0% - run-at-time 4,672 0% - timer-activate 4,672 0% timer--activate 192 0% timer-set-time 4,144 0% mode-local-on-major-mode-change 8,288 0% winner-save-unconditionally 5,688 0% - timer-event-handler 4,432 0% - apply 4,432 0% - blink-cursor-start 4,432 0% - blink-cursor--start-timer 4,432 0% - run-with-timer 4,432 0% - run-at-time 4,288 0% - timer-activate 4,288 0% timer--activate 144 0% timer-set-time 680 0% timer-inc-time 360 0% - timer-activate 360 0% timer--activate 4,328 0% - minibuffer-setup 4,144 0% vertico--setup 432 0% - minibuffer-mode 432 0% - run-mode-hooks 432 0% - run-hooks 432 0% - auto-revert--global-possibly-adopt-current-buffer 432 0% - auto-revert--global-adopt-current-buffer 432 0% - auto-revert-set-timer 432 0% - run-with-timer 432 0% - run-at-time 336 0% - timer-activate 336 0% timer--activate 96 0% timer-set-time 184 0% minibuffer-setup 184 0% minibuffer-setup 184 0% minibuffer-setup 34,902,868 22% + redisplay_internal (C function) 4,224 0% corfu--auto-post-command 4,207 0% + help-command-error-confusable-suggestions 4,144 0% winner-save-old-configurations 144 0% + timer-event-handler 0 0% ... ```
mclearc commented 1 year ago

Hmmm -- that's a lot of nodes. So I'm not really in a position to test it. But have you tried tweaking the information shown in the var consult-notes-org-roam-template. I'm thinking in particular of counting backlinks. I wonder if that is causing at least some of the slowdown -- it seems to be 20% in the cpu and 18% in the mem profile.

ParetoOptimalDev commented 1 year ago

@mclearc Yes, that helps a ton.

Not sure if it's enough for me to re-enable (though it might be...) given my sensitivty to latency, but for nearly everyone it will be I'm sure.

It's just about 1/2 second now... barely perceptible after:

(setq consult-notes-org-roam-template "${title:84} ${dir:12} ${sizes:6} ${fmtime} ${tags:10}")

If curious, here are the profiles after:

cpu profile ``` 469 72% - command-execute 394 60% - funcall-interactively 394 60% - execute-extended-command 394 60% - command-execute 394 60% - funcall-interactively 387 59% - org-roam-node-find 387 59% - org-roam-node-read 227 34% - completing-read-default 227 34% - apply 227 34% - vertico--advice 225 34% - # 223 34% - vertico--exhibit 222 34% - vertico--update 222 34% - vertico--recompute 221 34% - vertico--all-completions 221 34% - completion-all-completions 221 34% - apply 221 34% - # 221 34% - completion--nth-completion 221 34% - completion--some 221 34% - # 221 34% - orderless-all-completions 220 33% - orderless-filter 220 33% - # 220 33% - complete-with-action 55 8% - all-completions 29 4% - # 20 3% - # 1 0% commandp 1 0% version-to-list 1 0% - orderless--prefix+pattern 1 0% completion-boundaries 1 0% vertico-sort-history-length-alpha 1 0% vertico--display-candidates 160 24% - org-roam-node-read--completions 114 17% - # 114 17% - org-roam-node-read--to-candidate 113 17% - org-roam-node--format-entry 113 17% - org-roam-format-template 106 16% - replace-regexp-in-string 102 15% - # 83 12% - # 26 4% - org-roam-node-sizes 26 4% - apply 26 4% # 18 2% - org-roam-node-fmtime 18 2% - apply 18 2% - # 16 2% consult-notes--time 10 1% - org-roam-node-dir 9 1% - apply 9 1% # 8 1% truncate-string-to-width 1 0% - mapconcat 1 0% # 23 3% - org-roam-node-list 22 3% - org-roam-db-query 22 3% - emacsql 22 3% - apply 22 3% - # 11 1% - emacsql-wait 11 1% - apply 11 1% # 11 1% - emacsql-parse 11 1% - apply 11 1% # 1 0% # 23 3% - seq-sort 23 3% - apply 23 3% - # 23 3% sort 73 11% - byte-code 73 11% - read-extended-command 73 11% - read-extended-command-1 72 11% - completing-read-default 72 11% - apply 72 11% - vertico--advice 68 10% - # 42 6% - vertico--exhibit 22 3% - vertico--update 12 1% redisplay 9 1% - vertico--recompute 5 0% - vertico-sort-history-length-alpha 4 0% # 15 2% - vertico--arrange-candidates 15 2% - vertico--affixate 15 2% - # 15 2% - apply 15 2% - marginalia--affixate 15 2% - marginalia--cached 15 2% - marginalia-annotate-command 10 1% - marginalia--function-doc 9 1% - documentation 8 1% - substitute-command-keys 2 0% - # 1 0% - kill-buffer 1 0% - tabspaces--local-buffer-p 1 0% memq 1 0% - marginalia--documentation 1 0% - marginalia--truncate 1 0% truncate-string-to-width 5 0% vertico--display-candidates 5 0% - command-execute 5 0% - funcall-interactively 1 0% vertico-exit 1 0% - timer-event-handler 1 0% - apply 1 0% # 1 0% - minibuffer-inactive-mode 1 0% - run-mode-hooks 1 0% - run-hooks 1 0% - global-font-lock-mode-enable-in-buffers 1 0% - turn-on-font-lock-if-desired 1 0% - turn-on-font-lock 1 0% - font-lock-mode 1 0% font-lock-default-function 180 27% + ... 1 0% + timer-event-handler ```
mem profile ``` 47,460,873 79% - command-execute 26,030,638 43% - funcall-interactively 26,030,638 43% - execute-extended-command 26,030,638 43% - command-execute 26,030,606 43% - funcall-interactively 25,192,551 42% - org-roam-node-find 25,192,551 42% - org-roam-node-read 24,949,528 42% - org-roam-node-read--completions 11,688,534 19% - org-roam-node-list 11,688,534 19% - org-roam-db-query 11,688,534 19% - emacsql 11,688,534 19% - apply 11,688,534 19% - # 8,434,096 14% - emacsql-wait 8,434,096 14% - apply 8,434,096 14% - # 41,440 0% accept-process-output 3,174,564 5% - emacsql-parse 3,174,564 5% - apply 3,174,564 5% - # 2,400 0% read 79,831 0% - apply 78,439 0% - emacsql-compile 73,239 0% emacsql-format 5,200 0% - emacsql-prepare 3,808 0% - emacsql-prepare--string 1,392 0% replace-regexp-in-string 43 0% - emacsql-send-message 43 0% - apply 43 0% - # 43 0% - apply 43 0% # 11,589,784 19% - # 10,716,664 18% - org-roam-node-read--to-candidate 10,716,664 18% - org-roam-node--format-entry 10,716,664 18% - org-roam-format-template 8,820,816 14% - replace-regexp-in-string 7,245,144 12% - # 4,961,616 8% - # 946,356 1% - org-roam-node-sizes 946,356 1% - apply 946,356 1% # 743,580 1% - org-roam-node-fmtime 743,580 1% - apply 743,580 1% - # 671,084 1% - consult-notes--time 4,000 0% consult-notes--time-relative 518,096 0% truncate-string-to-width 409,008 0% mapconcat 260,296 0% - org-roam-node-dir 260,296 0% - apply 260,296 0% # 2,504 0% string-to-number 429,920 0% apply 1,658,784 2% - seq-sort 1,658,784 2% - apply 1,658,784 2% - # 1,610,184 2% sort 12,426 0% - org-roam-node--process-display-format 8,282 0% - org-roam-format-template 7,258 0% - replace-regexp-in-string 7,258 0% - # 1,024 0% # 217,039 0% - completing-read-default 217,039 0% - apply 217,039 0% - vertico--advice 183,755 0% - # 86,523 0% - vertico--exhibit 51,536 0% - vertico--update 51,536 0% - vertico--recompute 3,008 0% vertico-sort-history-length-alpha 31,801 0% - vertico--display-candidates 633 0% - vertico--resize-window 633 0% window-resize 2,170 0% vertico--display-count 1,016 0% vertico--arrange-candidates 1,300 0% - redisplay_internal (C function) 252 0% eval 208 0% - minibuffer-inactive-mode 208 0% - run-mode-hooks 208 0% - run-hooks 208 0% - auto-revert--global-possibly-adopt-current-buffer 208 0% - auto-revert--global-adopt-current-buffer 208 0% - auto-revert-set-timer 208 0% - run-with-timer 208 0% - run-at-time 144 0% - timer-activate 144 0% timer--activate 48 0% timer-set-time 184 0% minibuffer-setup 112 0% - minibuffer-mode 112 0% - run-mode-hooks 112 0% - run-hooks 112 0% - auto-revert--global-possibly-adopt-current-buffer 112 0% - auto-revert--global-adopt-current-buffer 112 0% - auto-revert-set-timer 112 0% - run-with-timer 112 0% - run-at-time 72 0% - timer-activate 72 0% timer--activate 24 0% timer-set-time 72 0% - timer-event-handler 72 0% - apply 72 0% - blink-cursor-start 72 0% - blink-cursor--start-timer 72 0% - run-with-timer 72 0% - run-at-time 24 0% timer-set-time 24 0% - timer-activate 24 0% timer--activate 16 0% command-execute 21,430,235 36% - byte-code 21,430,235 36% - read-extended-command 21,430,235 36% - read-extended-command-1 21,430,235 36% - completing-read-default 21,430,235 36% - apply 21,430,235 36% - vertico--advice 21,362,235 35% - # 11,888,854 20% - redisplay_internal (C function) 5,937,636 10% olivetti-set-window 10,704 0% eval 8,980,329 15% - vertico--exhibit 8,138,252 13% - vertico--arrange-candidates 8,045,308 13% - vertico--affixate 8,045,308 13% - # 8,045,308 13% - apply 8,043,260 13% - marginalia--affixate 8,042,212 13% - marginalia--cached 8,034,052 13% - marginalia-annotate-command 6,729,838 11% - marginalia--function-doc 1,964,346 3% - documentation 1,808,086 3% - substitute-command-keys 12,376 0% - # 12,376 0% - kill-buffer 12,376 0% - tabspaces--local-buffer-p 12,376 0% memq 3,072 0% key-valid-p 710 0% match-data 27,712 0% - marginalia--documentation 19,512 0% marginalia--truncate 63,352 0% - vertico--format-candidate 32,688 0% vertico--display-string 10,256 0% - # 7,112 0% orderless-highlight-matches 466,271 0% - vertico--update 288,591 0% - vertico--recompute 251,679 0% - vertico--all-completions 251,679 0% - completion-all-completions 251,679 0% - apply 251,679 0% - # 247,535 0% - completion--nth-completion 247,535 0% - completion--some 247,535 0% - # 247,535 0% - orderless-all-completions 243,391 0% - orderless-filter 232,135 0% - # 232,135 0% - complete-with-action 226,887 0% - all-completions 226,887 0% - # 131,399 0% - version-to-list 131,399 0% error 10,104 0% - orderless-pattern-compiler 6,400 0% orderless-regexp 1,632 0% - rx-to-string 1,632 0% - rx--translate 1,632 0% - rx--translate-form 1,632 0% - rx--translate-or 1,632 0% - rx--translate 1,632 0% rx--translate-form 1,152 0% isearch-no-upper-case-p 4,144 0% orderless-highlight-matches 22,032 0% vertico-sort-history-length-alpha 177,392 0% redisplay 353,058 0% - vertico--display-candidates 1,266 0% - vertico--resize-window 1,266 0% window-resize 21,700 0% vertico--display-count 5,192 0% - command-execute 5,032 0% - funcall-interactively 4,144 0% self-insert-command 264 0% - vertico-exit 56 0% vertico-insert 4,368 0% - timer-event-handler 4,240 0% - apply 4,144 0% show-paren-function 96 0% - blink-cursor-start 96 0% - blink-cursor--start-timer 96 0% - run-with-timer 96 0% - run-at-time 48 0% timer-set-time 48 0% - timer-activate 48 0% timer--activate 80 0% timer-inc-time 24 0% - timer-activate 24 0% timer--activate 4,288 0% - minibuffer-mode 4,144 0% global-font-lock-mode-cmhh 144 0% - run-mode-hooks 144 0% - run-hooks 144 0% - auto-revert--global-possibly-adopt-current-buffer 144 0% - auto-revert--global-adopt-current-buffer 144 0% - auto-revert-set-timer 144 0% - run-with-timer 144 0% - run-at-time 96 0% - timer-activate 96 0% timer--activate 48 0% timer-set-time 4,144 0% marginalia--minibuffer-setup 368 0% - minibuffer-inactive-mode 368 0% - run-mode-hooks 368 0% - run-hooks 368 0% - auto-revert--global-possibly-adopt-current-buffer 368 0% - auto-revert--global-adopt-current-buffer 368 0% - auto-revert-set-timer 368 0% - run-with-timer 368 0% - run-at-time 240 0% - timer-activate 240 0% timer--activate 96 0% timer-set-time 184 0% minibuffer-setup 184 0% minibuffer-setup 11,892,198 20% + redisplay_internal (C function) 2,048 0% corfu--auto-post-command 21 0% + help-command-error-confusable-suggestions 0 0% ... ```
ParetoOptimalDev commented 1 year ago

Oh it glancing at the profile it looks like removing sizes might just make it about equivalent... let's see.

ParetoOptimalDev commented 1 year ago

Yes, removing blinks and sizes makes the performance have very nearly no perceptible performance difference with 3200 nodes :smile:

  (setq consult-notes-org-roam-template "${title:84} ${dir:12} ${fmtime} ${tags:10}")
ParetoOptimalDev commented 1 year ago

This also makes it fast enough I can add this source to consult buffer!

(add-to-list 'consult-buffer-sources 'consult-notes-org-roam--nodes)
mclearc commented 1 year ago

I'm glad that works! I may update the readme with this info. I'm also going to be adding a new source allowing the scanning of org-agenda files in consult-notes. That might be of interest to you as well.

fuzzbomb commented 1 year ago

I tried out consult-notes for the first time today, and immediately noted the slowness too.

Hmmm -- that's a lot of nodes.

I don't think it is. If you're following a zettelkasten-like approach of using one note per idea (e.g. quotes, or jokes, or statistics, or code snippets), then 3200 isn't a surprisingly large number.

For comparison:

I note what's been said here about backlink-counts being a likely culprit of the slowness. If this is the case, could it be dropped from the default template?

mclearc commented 1 year ago

Hi @fuzzbomb -- I've pushed a commit that changes the defaults. Please see https://github.com/mclear-tools/consult-notes/commit/4d92996f676cecfebea6519dadf8cf185621a18a.