all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Charlie Andrews <andrews.charlie@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: profiler-report seems to be missing data?
Date: Wed, 15 Aug 2018 11:00:50 -0400	[thread overview]
Message-ID: <CAHV0hAiq1mgSYHbvjHCSpWeu0eMu12MKSvHC+k6RGVOs6hJ7QQ@mail.gmail.com> (raw)

I'm trying to profile the usually excellent `find-things-fast` package to
figure out why it's slow in my project.

I started profiling with `profiler-start`, executed the command that's slow
(`ftf-find-file`), then immediately ran `profiler-report`.

This generated the following report:

    Functions                                                 CPU samples  %
    - command-execute                                                1770
88%
     - call-interactively                                            1770
88%
      - apply                                                        1770
88%
       - call-interactively@ido-cr+-record-current-command
 1770  88%
        - apply                                                      1770
88%
         - #<subr call-interactively>                                1770
88%
          - funcall-interactively                                    1770
88%
           - ftf-find-file                                           1597
80%
            - ftf-project-files-alist                                1522
76%
             - ftf-project-files-hash                                1330
66%
              - let                                                  1330
66%
               - mapcar                                              1330
66%
                - #<lambda 0x5458e8e0>                               1024
51%
                 - let*                                              1008
50%
                    cons                                               24
 1%
                + split-string                                        282
14%
             + maphash                                                192
 9%
            + ido-completing-read                                      67
 3%
           + next-line                                                 75
 3%
           + ido-switch-buffer                                         41
 2%
           + ido-switch-buffer-other-window                            38
 1%
           + profiler-report                                           19
 0%
    + ...                                                             145
 7%
    + redisplay_internal (C function)                                  37
 1%
    + timer-event-handler                                              26
 1%
      undefined                                                         5
 0%
    + gui-set-selection                                                 4
 0%
      internal-echo-keystrokes-prefix                                   2
 0%

The profiler report seems to blame the `let*` function within
`ftf-project-files-hash`.

However, looking at that function:

    (defun ftf-project-files-hash ()
      "Returns a hashtable filled with file names as the key and "
      (let ((default-directory (ftf-project-directory))
            (table (make-hash-table :test 'equal)))
        (mapcar (lambda (file)
                  (let* ((file-name (file-name-nondirectory file))
                         (full-path (expand-file-name file))
                         (pathlist (cons full-path (gethash file-name table
nil))))
                    (puthash file-name pathlist table)))
                (split-string (ftf-project-files-string)))
        table))

It seems incredibly unlikely that `let*` is the slow part, but rather one
of the functions called within that `let*`.

Why is `profiler-report` stopping at `let*` rather than telling me which
component of that `let*` is slow? How can I dig deeper to find which
exactly function is slow?

(FWIW, I've tried increasing profiler-max-stack-depth from 16 to 30 to no
avail.)


             reply	other threads:[~2018-08-15 15:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15 15:00 Charlie Andrews [this message]
2018-08-15 18:46 ` profiler-report seems to be missing data? Eli Zaretskii
2018-08-16 13:47 ` Charlie Andrews
2018-08-16 14:19   ` Eli Zaretskii
2018-08-16 15:32     ` Michael Heerdegen
2018-08-16 17:12       ` Charlie Andrews
2018-08-16 17:28         ` Eli Zaretskii
2018-08-16 17:33           ` Charlie Andrews
2018-08-16 18:00             ` Eli Zaretskii
2018-08-16 18:48               ` Michael Heerdegen
2018-08-16 18:59                 ` Eli Zaretskii
2018-08-16 18:54         ` Michael Heerdegen
2018-08-16 22:47 ` Stefan Monnier
2018-08-17 15:36   ` Charlie Andrews
2018-08-19  5:06     ` Stefan Monnier

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=CAHV0hAiq1mgSYHbvjHCSpWeu0eMu12MKSvHC+k6RGVOs6hJ7QQ@mail.gmail.com \
    --to=andrews.charlie@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.