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

Lambda in lsp--create-filter-function creates tons of GC pressure #4677

Open
2 of 3 tasks
sin-ack opened this issue Jan 8, 2025 · 0 comments
Open
2 of 3 tasks

Lambda in lsp--create-filter-function creates tons of GC pressure #4677

sin-ack opened this issue Jan 8, 2025 · 0 comments
Labels

Comments

@sin-ack
Copy link

sin-ack commented Jan 8, 2025

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

The OmniSharp language server outputs a ton of diagnostic messages because it scans the entire project at startup. Due to the filter code performing substring operations on these large chunks of text, a lot of garbage is produced which makes Emacs extremely sluggish because it spends a lot of time garbage collecting. This persists until Emacs is able to consume all the input from the language server (which can take several minutes).

Steps to reproduce

  1. Find a rather large project, like https://github.com/dotnet/aspnetcore
  2. Start lsp with the OmniSharp language server

Expected behavior

I expect some lag from Emacs being pelted with diagnostics but it should still usable.

Which Language Server did you use?

OmniSharp

OS

Linux

Error callstack

No response

Anything else?

Memory profile:

("interpreted-function 9D1" points to this lambda)

2,811,178,162  66% - timer-event-handler
2,811,178,162  66%  - apply
2,808,766,934  66%   - #<byte-code-function 39E>
2,808,762,924  66%    - sit-for
2,804,581,068  65%     - #<interpreted-function 9D1>
2,804,581,068  65%      - let
2,804,581,068  65%       - while
2,775,587,524  65%        - if
2,775,587,524  65%         - let*
2,775,475,905  65%          - if
1,392,693,905  32%           - progn
1,381,131,984  32%            - setq
1,380,730,576  32%               substring-no-properties
      401,408   0%             - lsp--get-body-length
      401,408   0%              - mapcar
      241,688   0%               - split-string
      182,352   0%                - substring-no-properties
        2,304   0%                 - or
        2,304   0%                  - string-match-p
        2,304   0%                     string-match
      159,720   0%               - lsp--parse-header
      159,720   0%                - let
      157,544   0%                 - progn
      157,544   0%                  - setq
       83,888   0%                   - s-trim-left
       32,736   0%                      substring
       73,656   0%                     substring
        2,176   0%                   string-match
   11,561,921   0%            - condition-case
   11,561,921   0%             - let
   11,438,447   0%              - save-current-buffer
   11,438,447   0%               - unwind-protect
   11,438,447   0%                - progn
    7,412,575   0%                 - apply
    7,412,575   0%                    insert
    2,744,152   0%                 - setq
    2,744,152   0%                  - cons
    2,744,152   0%                   - json-parse-buffer
    2,744,152   0%                    - apply
    2,744,152   0%                     - lsp-booster--advice-json-parse
    2,744,152   0%                      - or
    2,744,152   0%                       - if
    2,744,152   0%                        - progn
    2,744,152   0%                         - let
    2,741,536   0%                            read
        2,616   0%                          - if
        2,616   0%                           - progn
        2,616   0%                            - funcall
        2,616   0%                             - #<byte-code-function D17>
        2,616   0%                                vector
    1,281,720   0%                   decode-coding-region
      123,474   0%                generate-new-buffer
1,382,782,000  32%           - prog1
1,380,794,032  32%            - setq
1,380,794,032  32%               substring-no-properties
    1,987,968   0%              substring-no-properties
        2,176   0%          - and
        2,176   0%           - string-match-p
        2,176   0%              string-match
        3,068   0%      message
          756   0%      execute-extended-command--describe-binding-msg
          186   0%    - #<byte-code-function 1E0>
          186   0%       message
    2,411,228   0%   - gcmh-idle-garbage-collect
    2,411,164   0%      garbage-collect
           64   0%      time-since
@sin-ack sin-ack added the bug label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant