Skip to content

Bad performance with adaptive-wrap-prefix-mode #558

@ksqsf

Description

@ksqsf

rust-mode's performance is extremely bad with adaptive-wrap-prefix-mode enabled. The profiler shows most of the time is spent in rust-in-comment-paragraph and in turn syntax-ppss.

rust-ts-mode does not suffer from this, but rust-mode is much more portable so I think a fix is still worth it. I'm not sure if it's really fixable, though.

edit: In rust-in-comment-paragraph, there are multiple calls to syntax-ppss-flush-cache. This problem can be fixed by removing them.

         618  52% - redisplay_internal (C function)
         477  40%  - jit-lock-function
         477  40%   - jit-lock-fontify-now
         477  40%    - jit-lock--run-functions
         477  40%     - #<compiled -0x156e01748b5230c3>
         477  40%      - adaptive-wrap-prefix-function
         477  40%       - adaptive-wrap-fill-context-prefix
         477  40%        - fill-context-prefix
         457  38%         - fill-match-adaptive-prefix
         427  36%          - rust-find-fill-prefix
         427  36%           - rust-in-comment-paragraph
         417  35%            - syntax-ppss
         387  32%             - syntax-propertize
         357  30%              - rust-syntax-propertize
         357  30%               - rust-ordinary-lt-gt-p
         237  20%                - rust-is-lt-char-operator
         207  17%                 - rust-is-in-expression-context
         167  14%                  - rust-is-in-expression-context
          68   5%                   + rust-rewind-qualified-ident
          59   5%                   + rust-rewind-irrelevant
          40   3%                   + rust-paren-level
          30   2%                  + rust-rewind-irrelevant
          30   2%                 + rust-rewind-irrelevant
          75   6%                - rust-in-macro
          56   4%                   syntax-ppss
          19   1%                 + rust-looking-back-macro-rules
          45   3%                - rust-in-str-or-cmnt
          45   3%                   syntax-ppss
          10   0%              #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15>
          30   2%          + current-left-margin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions