Skip to content

Poor performance when display-line-numbers is set to visual #657

Open
@polaris64

Description

@polaris64

When using php-mode, if display-line-numbers is set to 'visual then the performance when typing is very poor. The problem gets worse proportionally to the number of buffer lines; in my case it becomes noticeable when the buffer gets to around 30 lines.

Here is a profile when set to 'visual: -

- command-execute                                                 291  88%
 - call-interactively                                             291  88%
  - funcall-interactively                                         291  88%
   - self-insert-command                                          273  82%
    - c-after-change                                              138  41%
     - c-trim-found-types                                         138  41%
      - c-beginning-of-current-token                              138  41%
       - skip-syntax-backward                                     138  41%
        - internal--syntax-propertize                             138  41%
         - syntax-propertize                                      138  41%
          - php-syntax-propertize-function                        138  41%
           - php-syntax-propertize-hash-line-comment                138  41%
            - move-beginning-of-line                              137  41%
             - line-move                                          137  41%
                line-move-1                                       137  41%
    - electric-pair-post-self-insert-function                     135  41%
     - electric-pair-syntax-info                                  135  41%
      - syntax-ppss                                               135  41%
       - parse-partial-sexp                                       135  41%
        - internal--syntax-propertize                             135  41%
         - syntax-propertize                                      135  41%
          - php-syntax-propertize-function                        135  41%
           - php-syntax-propertize-hash-line-comment                134  40%
            - move-beginning-of-line                              134  40%
             - line-move                                          134  40%
                line-move-1                                       134  40%
   + counsel-M-x                                                   18   5%

Here is a profile when set to 'relative: -

- command-execute                                                  75  70%
 - call-interactively                                              75  70%
  - funcall-interactively                                          75  70%
   - self-insert-command                                           55  51%
    - electric-pair-post-self-insert-function                      29  27%
     - electric-pair-syntax-info                                   29  27%
      - syntax-ppss                                                29  27%
       - parse-partial-sexp                                        29  27%
        - internal--syntax-propertize                              29  27%
         - syntax-propertize                                       29  27%
          - php-syntax-propertize-function                         29  27%
           - php-syntax-propertize-hash-line-comment                 29  27%
            - move-beginning-of-line                               29  27%
             - line-move                                           29  27%
              - line-move-1                                        29  27%
               - vertical-motion                                    4   3%
                - jit-lock-function                                 4   3%
                 - jit-lock-fontify-now                             4   3%
                  - jit-lock--run-functions                         4   3%
                   - run-hook-wrapped                               4   3%
                    - #<compiled 0x157529864965>                    4   3%
                     - font-lock-fontify-region                     4   3%
                      - c-font-lock-fontify-region                  4   3%
                       - font-lock-default-fontify-region                  3   2%
                        - font-lock-fontify-keywords-region                  2   1%
                         - #<compiled 0x1575295055fd>                  1   0%
                          - c-beginning-of-decl-1                   1   0%
                           - c-beginning-of-statement-1                  1   0%
                              c-beginning-of-macro                  1   0%
                       - c-before-context-fl-expand-region                  1   0%
                        - mapc                                      1   0%
                         - #<compiled 0x157529228b15>                  1   0%
                          - c-context-expand-fl-region                  1   0%
                           - c-fl-decl-end                          1   0%
                              c-backward-sws                        1   0%
    - c-after-change                                               26  24%
     - c-trim-found-types                                          26  24%
      - c-beginning-of-current-token                               26  24%
       - skip-syntax-backward                                      26  24%
        - internal--syntax-propertize                              26  24%
         - syntax-propertize                                       26  24%
          - php-syntax-propertize-function                         26  24%
           - php-syntax-propertize-hash-line-comment                 26  24%
            - move-beginning-of-line                               26  24%
             - line-move                                           26  24%
                line-move-1                                        25  23%
   + counsel-M-x                                                   19  17%
   + evil-normal-state                                              1   0%
+ ...                                                              30  28%
+ redisplay_internal (C function)                                   1   0%
+ timer-event-handler                                               1   0%

I am using GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3) of 2020-08-28

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions