all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: WAROQUIERS Philippe via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "55636@debbugs.gnu.org" <55636@debbugs.gnu.org>,
	"DE BACKER Jurgen \(EXT\)" <jurgen.de-backer.ext@eurocontrol.int>,
	VAN VLIERBERGHE Stef <stef.van-vlierberghe@eurocontrol.int>
Subject: bug#55636: 27.2; etags performance fix when working with very big TAGS files
Date: Thu, 26 May 2022 17:25:29 +0000	[thread overview]
Message-ID: <5b7d2e64517641c581a9ed67857694c6@eurocontrol.int> (raw)
In-Reply-To: <83tu9cnxe2.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 6781 bytes --]

> > 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 #1.2: Type: text/html, Size: 32747 bytes --]

[-- Attachment #2: fast_string_match.png --]
[-- Type: image/png, Size: 221362 bytes --]

  reply	other threads:[~2022-05-26 17:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 16:04 bug#55636: 27.2; etags performance fix when working with very big TAGS files Jurgen De Backer via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-25 17:16 ` Eli Zaretskii
2022-05-25 20:42   ` VAN VLIERBERGHE Stef via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-26  5:07     ` Eli Zaretskii
2022-05-26 13:50       ` VAN VLIERBERGHE Stef via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-26 14:54         ` WAROQUIERS Philippe via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-26 15:09           ` Eli Zaretskii
2022-05-26 17:25             ` WAROQUIERS Philippe via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-05-26 19:10               ` Eli Zaretskii
2022-05-26 20:45                 ` WAROQUIERS Philippe via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b7d2e64517641c581a9ed67857694c6@eurocontrol.int \
    --to=bug-gnu-emacs@gnu.org \
    --cc=55636@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jurgen.de-backer.ext@eurocontrol.int \
    --cc=philippe.waroquiers@eurocontrol.int \
    --cc=stef.van-vlierberghe@eurocontrol.int \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.