bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55636: 27.2; etags performance fix when working with very big TAGS f


From: WAROQUIERS Philippe
Subject: bug#55636: 27.2; etags performance fix when working with very big TAGS files
Date: Thu, 26 May 2022 17:25:29 +0000

> > valgrind points at expand-file-name eating significant cpu (see attachment).

>

> I'm not sure I understand how to interpret that screenshot.

Each rectangle represents a function.

The nr inside the rectangle is the instructions used directly and indirectly by the function.

(direct cpu is spent in the function itself, indirect cpu is spend in the

called functions).

 

An arrow represents a call. The nr on the arrow represents the nr of calls.

So, what we can observe there is that the C function Fexpand_file_name makes 236_905 calls

to Ffind_File_name_handler

This Ffind_file_name_handler function makes 1.2 million calls to fast_string_match.

 

On this screenshot, we cannot see the CPU directly consumed by the functions,

but looking at the direct cpu shows that expand-file-name  cost is mostly due to the fast_string_match closure

 

(I have attached another screenshot as maybe  the fast search can be made faster.

E.g. it looks like builtin_lisp_symbol is called 213_000_000 times, is not inlined

while marked INLINE in the code or there are million of calls to maybe_quit inside re_match_2_internal).

 

 

> This says that most of the time is spent in tags-table-including.  If

> you manually load etags.el (NOT .elc!), and then profile the same

> operation, the profile could show in more detail which parts of

> tags-table-including takes most of the time, and we can take it from

> there.

Here is a more detailed lisp profile where I have expanded the costly branches.

 

- command-execute                                               10505  84%

- call-interactively                                           10504  84%

  - funcall-interactively                                       10327  83%

   - find-tag                                                   10316  82%

    - let*                                                      10316  82%

     - find-tag-noselect                                        10316  82%

      - let                                                     10316  82%

       - if                                                     10316  82%

        - if                                                     9832  79%

         - visit-tags-table-buffer                               9832  79%

          - cond                                                 9832  79%

           - setq                                                9831  79%

            - or                                                 9831  79%

             - and                                               9831  79%

              - save-current-buffer                              9831  79%

               - or                                              9831  79%

                - tags-table-including                           9831  79%

                 - let                                           9831  79%

                  - while                                        9831  79%

                   - if                                          9831  79%

                    - let                                        5399  43%

                     - if                                        5399  43%

                      - member                                   5396  43%

                       - mapcar                                  5384  43%

                        - tags-table-files                       1306  10%

                         - or                                    1306  10%

                          - setq                                 1306  10%

                           - funcall                             1306  10%

                            - etags-tags-table-files               1306  10%

                             + let                               1306  10%

                    - if                                         4432  35%

                     - tags-table-extend-computed-list               4432  35%

                      - let                                      4432  35%

                       - save-excursion                          4432  35%

                        - if                                     4432  35%

                         - tags-verify-table                     3292  26%

                          - apply                                3292  26%

                           - ad-Advice-tags-verify-table               3292  26%

                            + #<lambda 0x1b893daac4d25cc1>               3292  26%

                         - let                                   1140   9%

                          - tags-included-tables                 1140   9%

                           - or                                  1140   9%

                            - setq                               1140   9%

                             - funcall                           1140   9%

                              - etags-tags-included-tables               1140   9%

                               - let                             1140   9%

                                - while                          1126   9%

                                   if                              47   0%

                                   setq                            11   0%

           + tags-table-check-computed-list                         1   0%

        + let                                                     484   3%

   + execute-extended-command                                      11   0%

  + byte-code                                                     155   1%

  + find-tag-interactive                                           22   0%

+ ...                                                            1178   9%

+ redisplay_internal (C function)                                 730   5%

+ timer-event-handler                                              18   0%

  jit-lock--antiblink-post-command                                  1   0%

 

Thanks

Philippe

____

This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful.

Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy.

Any views expressed in this message are those of the sender.

Attachment: fast_string_match.png
Description: fast_string_match.png


reply via email to

[Prev in Thread] Current Thread [Next in Thread]