Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projectile and org-cycle cause delays during the expansion of the org tables. #1908

Open
arael opened this issue Oct 4, 2024 · 2 comments
Open

Comments

@arael
Copy link

arael commented Oct 4, 2024

Expanding org tables using tab has become extremely sluggish. It takes two to three seconds for the table to be expanded properly. The function bound to my tab key is org-cycle.

If I remove projectile from my installation, then the delays stop.

Expected behavior

No delays in expanding the org tables using tab (org-cycle).

Actual behavior

There is a delay of two to three seconds when expanding org tables using the tab key (org-cycle).

Steps to reproduce the problem

With projectile in your Emacs installation, visit an org file, type | then a letter, and then press tab. You should see a delay.

Environment & Version information

Projectile version information

Projectile version: 20240901.1554

Emacs version

29.3

Operating system

Ubuntu 24.04.1

Here is the Emacs profiler log, I hope it can be useful:

	3619  86% - command-execute
	2938  70%  - funcall-interactively
	2931  70%   - org-cycle
	2929  69%    - funcall-interactively
	2929  69%     - org-table-next-field
	2921  69%      - org-table-align
	1654  39%       - cl-mapcar
	1654  39%        - cl--mapcar-many
	1652  39%         - org-table--align-field
	1629  38%          - org-string-width
	1584  37%           - set-window-buffer
	1584  37%            - apply
	1477  35%             - #<subr set-window-buffer>
	1477  35%              - record-window-buffer
	1462  34%               - projectile-track-known-projects-find-file-hook
	 570  13%                - projectile-project-p
	 568  13%                 - projectile-project-root
	 554  13%                  - cl-some
	 554  13%                   - #<compiled 0x102e39d81079d55>
	 280   6%                    - file-truename
	 217   5%                     - file-truename
	 166   3%                      - file-truename
	 115   2%                       - file-truename
	  78   1%                        - file-truename
	  45   1%                         - file-truename
	  44   1%                          - tramp-completion-file-name-handler
	  39   0%                           - tramp-run-real-handler
	  39   0%                              apply
	 190   4%                    - projectile-root-marked
	 190   4%                     - projectile-root-bottom-up
	 189   4%                      - projectile-locate-dominating-file
	 155   3%                       - #<compiled -0x17ef8ac10091690f>
	  94   2%                        - mapcar
	  93   2%                           #<compiled 0x759ed441373c99c>
	  60   1%                        - cl-some
	  60   1%                           #<compiled 0x13403800b8d4454>
	   1   0%                    cl-subst
	 500  11%                - projectile-add-known-project
	 474  11%                 - projectile-merge-known-projects
	 332   7%                  - projectile-save-known-projects
	 328   7%                   - projectile-serialize
	  92   2%                    - write-region
	  56   1%                     - select-safe-coding-system
	  55   1%                        find-auto-coding
	  21   0%                     - make-lock-file-name
	   2   0%                        files--transform-file-name
	   7   0%                    - #<compiled -0x1c6ab75ee544ca3b>
	   2   0%                     - kill-buffer
	   1   0%                      - replace-buffer-in-windows
	   1   0%                       - unrecord-window-buffer
	   1   0%                        - assq-delete-all
	   1   0%                           assoc-delete-all
	 132   3%                  - projectile-unserialize
	  92   2%                   - insert-file-contents
	  87   2%                    - openwith-file-handler
	  84   2%                     - apply
	  45   1%                      - insert-file-contents
	  42   1%                       - set-auto-coding
	  40   0%                          find-auto-coding
	  10   0%                   - #<compiled -0x1c6ab75c2a9b5a3b>
	   5   0%                    - kill-buffer
	   2   0%                     - replace-buffer-in-windows
	   2   0%                        unrecord-window-buffer
	   8   0%                  - projectile-difference
	   5   0%                   - cl-remove-if
	   2   0%                      cl-remove
	 390   9%                - projectile-project-root
	 384   9%                 - cl-some
	 383   9%                  - #<compiled 0x102e39d81079d55>
	 217   5%                   - file-truename
	 172   4%                    - file-truename
	 122   2%                     - file-truename
	  82   1%                      - file-truename
	  35   0%                         file-truename
	  96   2%                   - projectile-root-marked
	  96   2%                    - projectile-root-bottom-up
	  95   2%                     - projectile-locate-dominating-file
	  71   1%                      - #<compiled -0x17ef8ac10091690f>
	  42   1%                       - mapcar
	  42   1%                          #<compiled 0x1240c391c1d8579e>
	  29   0%                       - cl-some
	  29   0%                          #<compiled 0x13403800b8d4454>
	  99   2%             - evil--swb-initialize
	  99   2%              - evil-initialize
	  97   2%               - evil-local-mode
	  89   2%                - evil-initialize-state
	  64   1%                 - evil-change-state
	  62   1%                  - evil-normal-state
	  58   1%                   - evil-normalize-keymaps
	  49   1%                    - evil-state-keymaps
	  15   0%                     - evil-state-keymaps
	   5   0%                        evil-state-intercept-keymaps
	   2   0%                      - evil-state-auxiliary-keymaps
	   1   0%                         evil-get-auxiliary-keymap
	  12   0%                     - evil-state-auxiliary-keymaps
	   3   0%                      - evil-get-auxiliary-keymap
	   3   0%                         evil-auxiliary-keymap-p
	   7   0%                       evil-state-intercept-keymaps
	   2   0%                       evil-state-overriding-keymaps
	   2   0%                   - overwrite-mode
	   2   0%                      called-interactively-p
	  13   0%                 - evil-initial-state-for-buffer
	   2   0%                    evil-initial-state
	   2   0%                - add-hook
	   1   0%                   #<compiled -0xfeba666b828d72>
	   2   0%               - evil-disabled-buffer-p
	   2   0%                  evil-initial-state-for-buffer-name
	  22   0%           - #<compiled 0x1e00fb680ac82e4c>
	  21   0%            - set-window-buffer
	  21   0%               apply
	  13   0%           - version<
	   1   0%              version-to-list
	   7   0%           - #<compiled -0x1c6ab75a83ca5e3b>
	   1   0%              kill-buffer
	1242  29%       - org-string-width
	1204  28%        - set-window-buffer
	1204  28%         - apply
	1128  26%          - #<subr set-window-buffer>
	1128  26%           - record-window-buffer
	1116  26%            - projectile-track-known-projects-find-file-hook
	 413   9%             - projectile-add-known-project
	 400   9%              - projectile-merge-known-projects
	 286   6%               - projectile-save-known-projects
	 282   6%                - projectile-serialize
	  85   2%                 - write-region
	  56   1%                  - select-safe-coding-system
	  53   1%                     find-auto-coding
	  17   0%                  - make-lock-file-name
	   1   0%                     files--transform-file-name
	   8   0%                 - #<compiled -0x1c6ab7593283aa3b>
	   3   0%                    kill-buffer
	 105   2%               - projectile-unserialize
	  73   1%                - insert-file-contents
	  71   1%                 - openwith-file-handler
	  67   1%                  - apply
	  35   0%                   - insert-file-contents
	  32   0%                    - set-auto-coding
	  31   0%                       find-auto-coding
	  16   0%                - #<compiled -0x1c6ab75c5abf0e3b>
	   5   0%                 - kill-buffer
	   3   0%                  - replace-buffer-in-windows
	   2   0%                   - unrecord-window-buffer
	   2   0%                      assq-delete-all
	   5   0%               - projectile-difference
	   5   0%                - cl-remove-if
	   1   0%                   cl-remove
	 379   9%             - projectile-project-root
	 375   8%              - cl-some
	 374   8%               - #<compiled 0x102e39d81079d55>
	 222   5%                - file-truename
	 173   4%                 - file-truename
	 149   3%                  - file-truename
	  98   2%                   - file-truename
	  65   1%                    - file-truename
	  45   1%                     - file-truename
	  43   1%                      - tramp-completion-file-name-handler
	  41   0%                       - tramp-run-real-handler
	  40   0%                          apply
	 105   2%                - projectile-root-marked
	 105   2%                 - projectile-root-bottom-up
	 105   2%                  - projectile-locate-dominating-file
	  82   1%                   - #<compiled -0x17ef8ac10091690f>
	  44   1%                    - mapcar
	  44   1%                       #<compiled 0x1240c391c1d8579e>
	  34   0%                    - cl-some
	  34   0%                       #<compiled 0x13403800b8d4454>
	 322   7%             - projectile-project-p
	 322   7%              - projectile-project-root
	 313   7%               - cl-some
	 313   7%                - #<compiled 0x102e39d81079d55>
	 190   4%                 - file-truename
	 153   3%                  - file-truename
	 107   2%                   - file-truename
	  68   1%                    - file-truename
	  23   0%                       file-truename
	  47   1%                 - projectile-root-marked
	  47   1%                  - projectile-root-bottom-up
	  44   1%                   - projectile-locate-dominating-file
	   1   0%                      abbreviate-file-name
	   1   0%            - push-window-buffer-onto-prev
	   1   0%             - assq-delete-all
	   1   0%                assoc-delete-all
	  70   1%          - evil--swb-initialize
	  69   1%           - evil-initialize
	  66   1%            - evil-local-mode
	  65   1%             - evil-initialize-state
	  54   1%              - evil-change-state
	  52   1%               - evil-normal-state
	  44   1%                - evil-normalize-keymaps
	  42   1%                 - evil-state-keymaps
	  13   0%                  - evil-state-auxiliary-keymaps
	   1   0%                     evil-mode-for-keymap
	  13   0%                  - evil-state-keymaps
	   5   0%                     evil-state-auxiliary-keymaps
	   5   0%                     evil-state-intercept-keymaps
	   3   0%                     evil-state-overriding-keymaps
	   5   0%                  - evil-state-intercept-keymaps
	   1   0%                   - evil-get-auxiliary-keymap
	   1   0%                      evil-auxiliary-keymap-p
	   2   0%                    evil-state-overriding-keymaps
	   1   0%                   evil-minor-mode-keymap-p
	   6   0%                - overwrite-mode
	   2   0%                   called-interactively-p
	   8   0%              - evil-initial-state-for-buffer
	   2   0%                 evil-initial-state-for-buffer-name
	   2   0%                 evil-initial-state
	   2   0%            - evil-disabled-buffer-p
	   1   0%               evil-initial-state-for-buffer-name
	  26   0%        - #<compiled 0x1e00fb680ac82e4c>
	  25   0%         - set-window-buffer
	  25   0%          - apply
	   1   0%             #<subr set-window-buffer>
	   5   0%        - #<compiled -0x1c6ab75b08ddee3b>
	   2   0%         - kill-buffer
	   2   0%            replace-buffer-in-windows
	   5   0%          version<
	   1   0%         org-indent-notify-modified-headline
	   1   0%         org-element--cache-after-change
	   1   0%       - #<compiled -0x221d3aef0d858dc>
	   1   0%        - org-table--shrink-columns
	   1   0%         - font-lock-ensure
	   1   0%          - jit-lock-fontify-now
	   1   0%           - jit-lock--run-functions
	   1   0%            - #<compiled -0x15693ea702f17cc3>
	   1   0%             - font-lock-fontify-region
	   1   0%                font-lock-default-fontify-region
	   2   0%    - org-element-at-point
	   2   0%       org-element--parse-to
	   7   0%   - execute-extended-command
	   7   0%    - command-execute
	   7   0%     - funcall-interactively
	   4   0%        profiler-stop
	   3   0%        profiler-start
	 681  16%  - byte-code
	 681  16%   - read-extended-command
	 681  16%    - apply
	 681  16%     - fcitx--minibuffer
	 681  16%      - apply
	 681  16%       - #<subr read-extended-command>
	 681  16%        - read-extended-command-1
	 681  16%         - completing-read-default
	 681  16%          - apply
	 681  16%           - vertico--advice
	 681  16%            - apply
	 670  16%             - #<subr completing-read-default>
	 598  14%              - vertico--exhibit
	 575  13%               - vertico--update
	 543  12%                - vertico--recompute
	 532  12%                 - vertico--filter-completions
	 532  12%                  - apply
	 532  12%                   - completion-all-completions
	 532  12%                    - apply
	 532  12%                     - #<subr completion-all-completions>
	 532  12%                      - completion--nth-completion
	 532  12%                       - completion--some
	 532  12%                        - #<compiled -0x116b407f241decfc>
	 532  12%                         - orderless-all-completions
	 532  12%                          - orderless--filter
	 532  12%                           - all-completions
	 532  12%                            - #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_55>
	 532  12%                             - complete-with-action
	  44   1%                              - all-completions
	  32   0%                               - #<compiled -0x16e85621199159ac>
	  24   0%                                - #<compiled -0x13928e7ae6ce8bb4>
	   2   0%                                 - commandp
	   2   0%                                  - interactive-form
	   2   0%                                   - oclosure-interactive-form
	   1   0%                                      apply
	   1   0%                                - version-to-list
	   1   0%                                   error
	  10   0%                 - vertico-sort-history-length-alpha
	   6   0%                  - mapcan
	   6   0%                   - #<compiled -0x1d117b1699ec641f>
	   5   0%                      sort
	  30   0%                - redisplay
	   3   0%                 - redisplay_internal (C function)
	   3   0%                  - redisplay--pre-redisplay-functions
	   1   0%                     run-hook-with-args
	  19   0%               - vertico--arrange-candidates
	  17   0%                - vertico--affixate
	  17   0%                 - #<compiled -0xae28039307b663f>
	  17   0%                  - apply
	  17   0%                   - marginalia--affixate
	  15   0%                    - marginalia--cached
	  15   0%                     - marginalia-annotate-command
	   8   0%                      - marginalia--function-doc
	   5   0%                       - documentation
	   3   0%                        - substitute-command-keys
	   2   0%                         - #<compiled -0x1c6ab75941ae623b>
	   2   0%                            kill-buffer
	   4   0%                        marginalia-annotate-binding
	   2   0%                      - marginalia--documentation
	   1   0%                       - marginalia--truncate
	   1   0%                          truncate-string-to-width
	   1   0%                - vertico--format-candidate
	   1   0%                 - apply
	   1   0%                    #<compiled -0x42e8b826d04318a>
	   3   0%               - vertico--display-candidates
	   3   0%                  vertico--resize-window
	   9   0%              - run-hooks
	   9   0%               - projectile-track-known-projects-find-file-hook
	   3   0%                - projectile-project-p
	   3   0%                 - projectile-project-root
	   3   0%                  - cl-some
	   3   0%                   - #<compiled 0x102e39d81079d55>
	   1   0%                      file-truename
	   1   0%                    - projectile-root-marked
	   1   0%                       projectile-root-bottom-up
	   3   0%                - projectile-project-root
	   3   0%                 - cl-some
	   3   0%                  - #<compiled 0x102e39d81079d55>
	   3   0%                   - file-truename
	   2   0%                    - file-truename
	   2   0%                     - file-truename
	   2   0%                      - file-truename
	   1   0%                       - file-truename
	   1   0%                        - file-truename
	   1   0%                         - tramp-completion-file-name-handler
	   1   0%                          - tramp-run-real-handler
	   1   0%                             apply
	   3   0%                - projectile-add-known-project
	   3   0%                 - projectile-merge-known-projects
	   3   0%                  - projectile-save-known-projects
	   3   0%                     projectile-serialize
	   7   0%              - #<compiled 0x1c0cda443a28e100>
	   4   0%               - comp-run-async-workers
	   1   0%                  mapcar
	   1   0%                - write-region
	   1   0%                 - select-safe-coding-system
	   1   0%                    find-auto-coding
	   1   0%                  #<compiled -0x1c6ab7431098263b>
	   2   0%              - redisplay_internal (C function)
	   2   0%               - eval
	   2   0%                - mood-line--process-format
	   2   0%                 - mood-line--escape
	   2   0%                    apply
	   1   0%                timer-event-handler
	   1   0%              - command-execute
	   1   0%               - funcall-interactively
	   1   0%                  self-insert-command
	   1   0%              - window--resize-root-window-vertically
	   1   0%               - window-sizable
	   1   0%                  window-min-size
	 547  13% - ...
	 547  13%    Automatic GC
	  13   0% - #<compiled -0x1a422bc26a36cf72>
	   5   0%  - comp-run-async-workers
	   2   0%   - make-process
	   2   0%    - apply
	   2   0%     - make-process@with-editor-process-filter
	   2   0%        apply
	   1   0%   - write-region
	   1   0%    - select-safe-coding-system
	   1   0%       find-auto-coding
	   5   0% - redisplay_internal (C function)
	   3   0%  - eval
	   3   0%   - mood-line--process-format
	   2   0%    - mood-line--process-segments
	   2   0%     - eval
	   2   0%        mood-line-segment-cursor-position
	   1   0%  - jit-lock-function
	   1   0%   - jit-lock-fontify-now
	   1   0%    - jit-lock--run-functions
	   1   0%     - #<compiled -0x15693eaabcd176c3>
	   1   0%      - font-lock-fontify-region
	   1   0%       - font-lock-default-fontify-region
	   1   0%        - font-lock-unfontify-region
	   1   0%           org-unfontify-region
	   3   0% - timer-event-handler
	   2   0%  - apply
	   1   0%     #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_11>
	   1   0%   - org-element--cache-sync
	   1   0%    - org-element--cache-process-request
	   1   0%     - avl-tree-delete
	   1   0%      - avl-tree--do-delete
	   1   0%       - avl-tree--do-delete
	   1   0%        - avl-tree--do-delete
	   1   0%           org-element--cache-compare
@codeasone
Copy link
Contributor

codeasone commented Oct 9, 2024

This is impacting me too when using org-ctrl-c-ctrl-c to send SQL to my DB, which generates org tables.

         985  96% - command-execute
         985  96%  - funcall-interactively
         978  96%   - org-ctrl-c-ctrl-c
         968  95%    - org-babel-execute-src-block
         808  79%     - org-babel-insert-result
         693  68%      - org-table-align
         392  38%       + cl-mapcar
         301  29%       - org-string-width
         301  29%        - set-window-buffer
         301  29%         - apply
         301  29%          - ad-Advice-set-window-buffer
         301  29%           - #<subr set-window-buffer>
         301  29%            - record-window-buffer
         301  29%             - apply
         301  29%              - run-hooks
         301  29%               - projectile-track-known-projects-find-file-hook
         167  16%                + projectile-add-known-project
         127  12%                - projectile-project-p
         127  12%                 - projectile-project-root
         127  12%                  - cl-some
         127  12%                   + #<compiled 0x2c6cc6f477c3923>
           7   0%                + projectile-project-root
         110  10%      + orgtbl-to-orgtbl
           3   0%      + org-at-table-p
         160  15%     + org-babel-execute:sql
          10   0%    + org-ai-ctrl-c-ctrl-c
          31   3% + ...

If I reset projectile to the commit before 3c92d28 then the performance issues disappear.

@bbatsov
Copy link
Owner

bbatsov commented Oct 9, 2024

@codeasone Feel free to submit a PR reverting the problematic commit. Seems to me this is our best course of action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants