all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* profiling latency in large org-mode buffers (under both main & org-fold feature)
@ 2022-02-21 21:06 Matt Price
  2022-02-21 22:22 ` Samuel Wales
  2022-02-22  5:30 ` Ihor Radchenko
  0 siblings, 2 replies; 40+ messages in thread
From: Matt Price @ 2022-02-21 21:06 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 3611 bytes --]

I'm trying to figure out what causes high latency while typing in large
org-mode files.  The issue is very clearly a result of my large config
file, but I'm not sure how to track it down with any precision.

My main literate config file is ~/.emacs.d/emacs-init.org, currently 15000
lines, 260 src blocks.
If I create a ~minimal.el~ config like this:

(let* ((all-paths
          '("/home/matt/src/org-mode/emacs/site-lisp/org")))
    (dolist (p all-paths)
      (add-to-list 'load-path p)))

  (require 'org)
  (find-file "~/.emacs.d/emacs-init.org")

then I do not notice any latency while typing.  If I run the profiler while
using the minimal config, the profile looks about like this at a high
level:

        1397  71% - command-execute
         740  37%  - funcall-interactively
         718  36%   - org-self-insert-command
         686  34%    + org-element--cache-after-change
          10   0%    + org-fold-core--fix-folded-region
           3   0%    + blink-paren-post-self-insert-function
           2   0%    + jit-lock-after-change
           1   0%      org-fold-check-before-invisible-edit--text-properties
           9   0%   + previous-line
           6   0%   + minibuffer-complete
           3   0%   + org-return
           3   0%   + execute-extended-command
         657  33%  - byte-code
         657  33%   - read-extended-command
          64   3%    - completing-read-default
          14   0%     + redisplay_internal (C function)
           1   0%     + timer-event-handler
         371  18% - redisplay_internal (C function)
         251  12%  + jit-lock-function
          90   4%  + assq
           7   0%  + substitute-command-keys
           3   0%  + eval
         125   6% + timer-event-handler
          69   3% + ...

--------------------------
However, if I instead use my fairly extensive main config, latency is high
enough that there's a noticeable delay while typing ordinary words. I see
this  regardless of whether I build from main or from Ihor's org-fold
feature branch on github. The profiler overview here is pretty different --
redisplay_internal takes a much higher percentage of the CPU requirement:

         3170  56% - redisplay_internal (C function)
         693  12%  - substitute-command-keys
         417   7%   + #<compiled -0x1c8b98a4b03336f3>
          59   1%  + assq
          49   0%  + org-in-subtree-not-table-p
          36   0%  + tab-bar-make-keymap
          35   0%    and
          24   0%  + not
          16   0%    org-at-table-p
          13   0%  + jit-lock-function
           8   0%    keymap-canonicalize
           7   0%  + #<compiled 0x74a551771c7fdf1>
           4   0%  + funcall
           4   0%    display-graphic-p
           3   0%  + #<compiled 0xe5940664f7881ee>
           3   0%    file-readable-p
           3   0%  + table--probe-cell
           3   0%    table--row-column-insertion-point-p
        1486  26% - command-execute
        1200  21%  - byte-code
        1200  21%   - read-extended-command
        1200  21%    - completing-read-default
        1200  21%     - apply
        1200  21%      - vertico--advice
         475   8%       + #<subr completing-read-default>

----------------------
I've almost never used the profiler and am not quite sure how I should
proceed to debug this.  I realize I can comment out parts of the config one
at a time, but that is not so easy for me to do in my current setup, and I
suppose there are likely to be multiple contributing causes, which I may
not really notice except in the aggregate.

If anyone has suggestions, I would love to hear them!

Thanks,

Matt

[-- Attachment #2: Type: text/html, Size: 4640 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2022-04-24  4:26 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-21 21:06 profiling latency in large org-mode buffers (under both main & org-fold feature) Matt Price
2022-02-21 22:22 ` Samuel Wales
2022-02-22  5:33   ` Ihor Radchenko
2022-02-22  5:44     ` Kaushal Modi
     [not found]       ` <CAN_Dec8kW5hQoa0xr7sszafYJJNmGipX0DA94DKNh11DWjce8g@mail.gmail.com>
2022-02-23  2:41         ` Matt Price
2022-02-23  5:22           ` Ihor Radchenko
2022-02-23 14:47             ` Matt Price
2022-02-23 15:10               ` Ihor Radchenko
2022-02-22 21:11     ` Rudolf Adamkovič
2022-02-23 12:37       ` Org mode profiling meetup on Sat, Feb 26 (was: profiling latency in large org-mode buffers (under both main & org-fold feature)) Ihor Radchenko
2022-02-23 16:43         ` Kaushal Modi
2022-02-25 14:30         ` Ihor Radchenko
2022-02-26 12:04           ` Ihor Radchenko
2022-02-26 12:51             ` Ihor Radchenko
2022-02-26 15:51               ` Quiliro Ordóñez
2022-03-23 10:57                 ` #2 Org mode profiling meetup on Sat, Mar 26 (was: Org mode profiling meetup on Sat, Feb 26 (was: profiling latency in large org-mode buffers (under both main & org-fold feature))) Ihor Radchenko
2022-03-24 11:17                   ` Ihor Radchenko
2022-03-24 11:27                   ` Bruce D'Arcus
2022-03-24 13:43                     ` Matt Price
2022-03-24 13:49                     ` Ihor Radchenko
2022-03-26 11:59                   ` Ihor Radchenko
2022-03-27  8:14                     ` Ihor Radchenko
2022-04-21  8:05                   ` #3 Org mode profiling meetup on Sat, Apr 23 (was: #2 Org mode profiling meetup on Sat, Mar 26) Ihor Radchenko
2022-04-23 12:08                     ` Ihor Radchenko
2022-04-24  4:27                       ` Ihor Radchenko
2022-02-27  7:41               ` Org mode profiling meetup on Sat, Feb 26 (was: profiling latency in large org-mode buffers (under both main & org-fold feature)) Ihor Radchenko
2022-02-23 16:03     ` profiling latency in large org-mode buffers (under both main & org-fold feature) Max Nikulin
2022-02-23 16:35       ` Ihor Radchenko
2022-02-25 12:38         ` Max Nikulin
2022-02-26  7:45           ` Ihor Radchenko
2022-02-26 12:45             ` Max Nikulin
2022-02-27  6:43               ` Ihor Radchenko
2022-03-02 12:23                 ` Max Nikulin
2022-03-02 15:12                   ` Ihor Radchenko
2022-03-03 14:56                     ` Max Nikulin
2022-03-19  8:49                       ` Ihor Radchenko
2022-02-26 15:07     ` Jean Louis
2022-02-23  2:39   ` Matt Price
2022-02-23  5:25     ` Ihor Radchenko
2022-02-22  5:30 ` Ihor Radchenko

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.