bug#81150: 31.0.60; eglot: performance issue with markdown-ts-mode

Romain Ouabdelkader <[email protected]> Fri, 7 Aug 2026 11:04:26 +0200
Newsgroups gmane.emacs.bugs
Message-ID <CAJ8YToY_st0ksAq70gdRCobG-S6qZxH3e6PFAyxYnqSE-Hfihw@mail.gmail.com>
I realized that the previous profile (profile32.txt) was made with (setq
eglot-documentation-renderer 'markdown-ts-mode)
I re-tried with (setq eglot-documentation-renderer 'markdown-ts-view-mode),
just to be sure, I still the same freeze.

Attached is a profile with markdown-ts-view-mode.
profile32-view-mode.txt (text/plain, 16 KB)
       21119  95% - timer-event-handler
       21119  95%  - apply
       21016  94%   - #<byte-code-function 34C>
       21015  94%    - jsonrpc-connection-receive
       20998  94%     - jsonrpc--continue
       20998  94%      - #<byte-code-function 644>
       20998  94%       - apply
       20998  94%        - #<byte-code-function 2AB>
       20766  93%         - mapconcat
       20748  93%          - #<byte-code-function 278>
       20748  93%           - eglot--sig-info
       20716  93%            - eglot--format-markup
       20652  93%             - font-lock-ensure
       20650  93%              - #<byte-code-function 3D6>
       20649  93%               - font-lock-fontify-region
       20649  93%                - font-lock-default-fontify-region
       20644  93%                 - font-lock-fontify-syntactically-region
       20644  93%                  - treesit-font-lock-fontify-region
       20459  92%                   - treesit-update-ranges
       20458  92%                    - treesit--update-range-1
       20446  92%                     - treesit--update-ranges-local
       19427  87%                      - treesit-query-range
           5   0%                         treesit-pattern-expand
        1012   4%                        treesit-query-range-by-language
           3   0%                        treesit--set-embed-ranges
         153   0%                   - treesit--font-lock-fontify-region-1
          27   0%                    - markdown-ts--fontify-entity
          12   0%                     - markdown-ts--decode-entity
           5   0%                      - org-entity-get
           5   0%                         assoc
           1   0%                        match-string
           8   0%                     - treesit-fontify-with-override
           7   0%                      - font-lock-append-text-property
           7   0%                         font-lock--add-text-property
           3   0%                       treesit-node-text
           7   0%                    - markdown-ts--fontify-hard-line-break
           2   0%                     - treesit-fontify-with-override
           2   0%                      - font-lock-append-text-property
           2   0%                         font-lock--add-text-property
           1   0%                       treesit-node-text
           4   0%                    - markdown-ts--fontify-delimiter
           2   0%                     - treesit-fontify-with-override
           1   0%                      - font-lock-prepend-text-property
           1   0%                         font-lock--add-text-property
           3   0%                    - markdown-ts--fontify-backslash-escape
           2   0%                     - treesit-fontify-with-override
           2   0%                      - font-lock-append-text-property
           2   0%                         font-lock--add-text-property
           1   0%                    - treesit-fontify-with-override
           1   0%                     - font-lock-prepend-text-property
           1   0%                        font-lock--add-text-property
           1   0%                      facep
           1   0%                    - markdown-ts--fontify-link-node
           1   0%                       markdown-ts--make-link-button
          15   0%                   - cl-remove-if-not
          15   0%                    - cl-remove
           5   0%                     - funcall
           5   0%                      - #<byte-code-function 3E4>
           2   0%                         treesit-node-language
           9   0%                     treesit-parser-root-node
           2   0%                   font-lock-fontify-keywords-region
           1   0%                   #<byte-code-function 659>
           2   0%                font-lock-set-defaults
          31   0%             - markdown-ts-view-mode
          27   0%              - markdown-ts-mode--initialize
          27   0%               - markdown-ts--set-up
           7   0%                - treesit-major-mode-setup
           2   0%                 - treesit-font-lock-recompute-features
           1   0%                    treesit-validate-and-compile-font-lock-rules
           1   0%                 - copy-tree
           1   0%                    copy-tree
           1   0%                   treesit-thing-defined-p
           4   0%                - jit-lock-register
           4   0%                 - jit-lock-mode
           3   0%                    jit-lock-refontify
           1   0%                    add-hook
           2   0%                - outline-minor-mode
           1   0%                   add-to-invisibility-spec
           1   0%                  markdown-ts--range-settings
           1   0%                  treesit-range-rules
           1   0%                  add-hook
           1   0%                  add-to-list
           3   0%                markdown-ts-add-final-newline
          15   0%               buffer-string
          10   0%               string-trim
           4   0%               generate-new-buffer
           3   0%             - #<byte-code-function 1E6>
           3   0%                kill-buffer
           1   0%               make-local-variable
          16   0%            - replace-regexp-in-string
          11   0%               concat
         232   1%         - #<byte-code-function 8AD>
         232   1%          - #<byte-code-function BFC>
         232   1%           - run-hook-with-args
         232   1%            - eldoc-display-in-echo-area
         232   1%             - eldoc--message
         232   1%              - eldoc-minibuffer-message
         232   1%               - message
         220   0%                - redisplay_internal (C function)
           6   0%                 - eval
           4   0%                  - cl-loop
           4   0%                   - cl-block
           3   0%                    - cl--block-wrapper
           3   0%                     - let
           3   0%                      - catch
           3   0%                       - let*
           3   0%                        - cl-loop
           3   0%                         - cl-block
           3   0%                          - cl--block-wrapper
           3   0%                           - let
           3   0%                            - catch
           3   0%                             - let*
           3   0%                              - while
           2   0%                               - setq
           1   0%                                  cdr
           1   0%                                - format-mode-line
           1   0%                                 - eval
           1   0%                                  - when-let
           1   0%                                   - if-let*
           1   0%                                    - let*
           1   0%                                     - if
           1   0%                                      - cl-loop
           1   0%                                       - #<byte-code-function 9F7>
           1   0%                                          cl--loop-build-ands
           1   0%                               - cl-callf
           1   0%                                - #<byte-code-function 4A0>
           1   0%                                   gv-get
           1   0%                    mode-line-window-control
           1   0%                    flymake--mode-line-exception
           2   0%                 - funcall
           2   0%                  - #<byte-code-function FE6>
           2   0%                   - gui-backend-selection-exists-p
           2   0%                    - apply
           2   0%                     - #<byte-code-function C0A>
           2   0%                        ns-selection-exists-p
           1   0%                 - and
           1   0%                    not
          16   0%     - apply
          16   0%      - jsonrpc--event
          16   0%       - #<byte-code-function E1A>
          16   0%        - apply
          16   0%           jsonrpc--log-event
           1   0%     - #<byte-code-function B7B>
           1   0%        jsonrpc--call-deferred
           1   0%      generate-new-buffer
          97   0%   - eldoc--update
          97   0%    - eldoc-print-current-symbol-info
          97   0%     - eldoc--invoke-strategy
          97   0%      - eldoc-documentation-compose
          76   0%       - eglot-code-action-suggestion
          62   0%        - eglot--async-request
          62   0%         - jsonrpc-async-request
          61   0%          - jsonrpc--async-request-1
          61   0%           - apply
          61   0%            - jsonrpc-connection-send
          61   0%             - apply
          61   0%              - #<byte-code-function 20D>
          61   0%                 process-send-string
          14   0%        - eglot--code-action-bounds
          14   0%         - bounds-of-thing-at-point
           8   0%          - thing-at-point--beginning-of-sexp
           8   0%           - forward-sexp
           8   0%            - python-nav-forward-sexp
           8   0%             - python-nav--forward-sexp
           3   0%              - python-info-beginning-of-statement-p
           3   0%               - python-nav-beginning-of-statement
           1   0%                - python-info-line-ends-backslash-p
           1   0%                 - syntax-ppss
           1   0%                    parse-partial-sexp
           1   0%                - syntax-ppss
           1   0%                   parse-partial-sexp
           1   0%                  back-to-indentation
           2   0%              - python-info-beginning-of-block-p
           1   0%               - python-info-beginning-of-statement-p
           1   0%                - python-nav-beginning-of-statement
           1   0%                 - syntax-ppss
           1   0%                    parse-partial-sexp
           1   0%               - python-info-statement-starts-block-p
           1   0%                - python-nav-beginning-of-statement
           1   0%                   python-info-line-ends-backslash-p
           2   0%              - python-syntax-context-type
           2   0%               - syntax-ppss
           2   0%                  parse-partial-sexp
           1   0%              - python-info-end-of-statement-p
           1   0%               - python-nav-end-of-statement
           1   0%                - syntax-ppss
           1   0%                   parse-partial-sexp
           1   0%          - thing-at-point--end-of-sexp
           1   0%           - forward-sexp
           1   0%              python-nav-forward-sexp
           1   0%            make-closure
          12   0%       - eglot-hover-eldoc-function
          12   0%        - eglot--async-request
          12   0%         - jsonrpc-async-request
          12   0%          - jsonrpc--async-request-1
          12   0%           - apply
          12   0%            - jsonrpc-connection-send
          12   0%             - apply
          12   0%              - #<byte-code-function 20D>
          12   0%                 process-send-string
           8   0%       - eglot-highlight-eldoc-function
           8   0%        - eglot--async-request
           8   0%         - jsonrpc-async-request
           8   0%          - jsonrpc--async-request-1
           8   0%           - apply
           8   0%            - jsonrpc-connection-send
           8   0%             - apply
           8   0%              - #<byte-code-function 20D>
           8   0%                 process-send-string
           1   0%       - eglot-signature-eldoc-function
           1   0%        - eglot--async-request
           1   0%         - jsonrpc-async-request
           1   0%          - jsonrpc--async-request-1
           1   0%           - apply
           1   0%            - jsonrpc-connection-send
           1   0%             - apply
           1   0%              - #<byte-code-function 20D>
           1   0%                 process-send-string
           5   0%   - show-paren-function
           5   0%    - show-paren--default
           3   0%     - show-paren--locate-near-paren
           1   0%        back-to-indentation
           2   0%       syntax-ppss
           1   0%   - jit-lock-context--update
           1   0%      jit-lock-context-fontify
         546   2% - redisplay_internal (C function)
           1   0%  - eval
           1   0%     mode-line--minor-modes
         349   1%   Automatic GC
         123   0% - command-execute
         120   0%  - byte-code
         120   0%   - read-extended-command
         120   0%    - read-extended-command-1
         120   0%     - completing-read-default
          35   0%      - redisplay_internal (C function)
           1   0%       - funcall
           1   0%        - #<byte-code-function FE6>
           1   0%         - gui-backend-selection-exists-p
           1   0%          - apply
           1   0%           - #<byte-code-function C0A>
           1   0%              ns-selection-exists-p
           7   0%      - command-execute
           7   0%       - funcall-interactively
           7   0%        - minibuffer-complete
           7   0%         - completion-in-region
           7   0%          - completion--in-region
           7   0%           - #<byte-code-function 0DC>
           7   0%            - apply
           7   0%             - #<byte-code-function 2AF>
           7   0%              - completion--in-region-1
           7   0%               - completion--do-completion
           5   0%                - completion-try-completion
           5   0%                 - completion--nth-completion
           5   0%                  - seq-some
           5   0%                   - seq-do
           5   0%                    - mapc
           5   0%                     - #<byte-code-function 7D9>
           5   0%                      - #<byte-code-function 72E>
           5   0%                       - eval
           5   0%                        - let
           5   0%                         - funcall
           5   0%                          - #<byte-code-function 7A1>
           5   0%                           - completion-basic-try-completion
           5   0%                            - #<native-comp-function F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_56>
           5   0%                             - complete-with-action
           5   0%                                try-completion
           2   0%                  minibuffer-completion-help
           5   0%      - timer-event-handler
           5   0%       - apply
           5   0%        - completions--background-update
           4   0%           input-pending-p
           1   0%         - redisplay
           1   0%            redisplay_internal (C function)
           3   0%  - funcall-interactively
           2   0%   - next-line
           2   0%      line-move
           1   0%   - execute-extended-command
           1   0%    - command-execute
           1   0%     - funcall-interactively
           1   0%        profiler-start
          41   0% - eldoc-pre-command-refresh-echo-area
          41   0%  - eldoc--message
          41   0%   - eldoc-minibuffer-message
          41   0%      message
           1   0% - ...
           1   0%  - completion-all-completions
           1   0%   - completion--nth-completion
           1   0%    - seq-some
           1   0%     - seq-do
           1   0%      - mapc
           1   0%       - #<byte-code-function 0F8>
           1   0%        - #<byte-code-function 0B4>
           1   0%         - eval
           1   0%          - let
           1   0%           - funcall
           1   0%            - #<byte-code-function 0D0>
           1   0%             - completion-basic-all-completions
           1   0%              - completion-pcm--all-completions
           1   0%               - #<native-comp-function F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_56>
           1   0%                - complete-with-action
           1   0%                   all-completions
           1   0% - jsonrpc--process-filter
           1   0%  - jsonrpc--json-read
           1   0%     json-parse-buffer