emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: Samuel Wales <samologist@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: profiling latency in large org-mode buffers (under both main & org-fold feature)
Date: Tue, 22 Feb 2022 21:39:19 -0500	[thread overview]
Message-ID: <CAN_Dec8tJHK3==qKeN9nE51LmkieYW89yCpGWQmOOX9mV0zNGA@mail.gmail.com> (raw)
In-Reply-To: <CAJcAo8vNKsHeWYJOuM-vD8xro-FMn_dk8w4H9eXocdK+ojDbEw@mail.gmail.com>

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

Yes, it definitely seems to be related tofile size, which makes me think
that some kind of buffer parsing is the cause of the problem. I'll replay
in more detail to Ihor, down below!

On Mon, Feb 21, 2022 at 5:22 PM Samuel Wales <samologist@gmail.com> wrote:

> i have been dealing with latency also, often in undo-tree.  this might
> be a dumb suggestion, but is it related to org file size?  my files
> have not really grown /that/ much but maybe you could bisect one.  as
> opposed to config.
>
> i am not saying that your org files are too big.  just that maybe it
> could lead to insights.
>
>
> On 2/21/22, Matt Price <moptop99@gmail.com> wrote:
> > 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
> >
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>

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

  parent reply	other threads:[~2022-02-23  2:40 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-02-23  5:25     ` Ihor Radchenko
2022-02-22  5:30 ` Ihor Radchenko

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CAN_Dec8tJHK3==qKeN9nE51LmkieYW89yCpGWQmOOX9mV0zNGA@mail.gmail.com' \
    --to=moptop99@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=samologist@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).