emacs-tree-sitter / ts-fold

Code-folding using tree-sitter
GNU General Public License v3.0
221 stars 28 forks source link

`ts-fold-line-comment-mode` is very slow #115

Open guibor opened 8 months ago

guibor commented 8 months ago

Happy to provide more details, my use is in Python mode and in emacs 29.1 (on Mac OS, but I don't think it matters here)

jcs090218 commented 8 months ago

Can you try the profiler and paste the result here? In theory, it shouldn't be slow. 🤔

Thank you!

vv111y commented 4 weeks ago

fwiw I have a big performance issue in org-mode for 723K org file. I can open a separate issue if you want. Here is the profile:

         828  65% - ...
         710  56%  - ts-fold-indicators--render-window
         710  56%   - if
         710  56%    - progn
         710  56%     - let
         710  56%      - save-current-buffer
         710  56%       - unwind-protect
         710  56%        - progn
         710  56%         - condition-case
         710  56%          - progn
         710  56%           - ts-fold-indicators-refresh
         710  56%            - if
         710  56%             - progn
         710  56%              - if
         710  56%               - progn
         710  56%                - let*
         461  36%                 - if
         461  36%                  - progn
         400  31%                   - mapc
         399  31%                    - ts-fold-indicators--create
         399  31%                     - let*
         394  31%                      - if
         394  31%                       - let
         270  21%                        - ts-fold-indicators--create-overlays
         270  21%                         - let
         240  18%                          - save-excursion
         240  18%                           - while
         233  18%                            - setq
         233  18%                             - cons
         233  18%                              - ts-fold-indicators--create-overlay-at-point
         231  18%                                 let*
           3   0%                            + and
          30   2%                          + ts-fold-indicators--update-overlays
         124   9%                        + ts-fold-overlay-at
           5   0%                      + and
          61   4%                     ts-fold-indicators--remove-ovs
         249  19%                 - and
          89   7%                    tsc-query-captures
           7   0%                  + condition-case
           1   0%                  + cl-remove-if-not
         118   9%    Automatic GC
         351  27% + command-execute
          62   4% + timer-event-handler
          23   1% + redisplay_internal (C function)
           3   0% + clean-aindent--check-last-point
jcs090218 commented 4 weeks ago

I might need some work on the line comment mode, but I'm unsure if there is space for improvement. 🤔

vv111y commented 4 weeks ago

It's also just happened in elisp, my init.el file at 88k. Same profile