emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: William Xu <william.xwl@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: prettify-symbols-mode in org agenda?
Date: Tue, 04 May 2021 12:23:02 +0800	[thread overview]
Message-ID: <87y2cvyvo9.fsf@localhost> (raw)
In-Reply-To: <87k0ofn3er.fsf@gnu.org>

Bastien <bzg@gnu.org> writes:
> Could it slow down agenda generation for some configurations?

Yes, it can. Specifically, fontifying tags can be costly. For
illustration, below if profiler report for a very large agenda buffer
(1468 entries):

19820  95%   - org-agenda
...
4401  21%                   - org-agenda-fix-displayed-tags
3711  17%                    + org-mode
...
1410   6%                  - org-buffer-substring-fontified
1380   6%                   + jit-lock-fontify-now
(full profiler report at the end of the message)

The total slowdown is ~30%, though the second part will only be slow
before the headings are fontified first time by
org-buffer-substring-fontified. Subsequent agenda rebuilds will be
faster.

The first part is harder. It is related to tag fontification. Currently,
agenda fetches tag list as unfontified strings via org-get-tags. So, I
had to re-fontify tags manual is temporary org-mode buffer. You can see
that running org-mode in fresh buffer takes a lot of time. Alternative
approach would be modifying org-get-tags to return fontified strings,
but I am not sure if it is safe to do - unrelated parts of org
might be affected. Or I can write something like org-get-tags-fontified.
What do you think?

Best,
Ihor
20147  96% - command-execute
20147  96%  - funcall-interactively
19820  95%   - org-agenda
19820  95%    - apply
19820  95%     - ad-Advice-org-agenda
19820  95%      - #<compiled -0x1c8480b91ecb5c12>
19820  95%       - apply
19820  95%        - #<compiled -0xb7e1059dab93556>
19761  94%         - call-interactively
19761  94%          - funcall-interactively
19741  94%           - org-todo-list
13331  63%            - org-agenda-get-day-entries
13331  63%             - apply
13331  63%              - #<compiled -0xff9c793bf0466ec>
13331  63%               - org-agenda-get-todos
13331  63%                - apply
13331  63%                 - #<compiled -0x1e7566f8a2160f5f>
8115  38%                  - org-agenda-format-item
4401  21%                   - org-agenda-fix-displayed-tags
3711  17%                    + org-mode
409   1%                    + font-lock-ensure
161   0%                    + org-fold-core--fix-folded-region
40   0%                    + #<compiled -0x1c8bdc957a9aff0b>
3554  17%                   - eval
3554  17%                    - format
3554  17%                     - format
3544  17%                      - org-eval
3463  16%                       + yant/format-time-balance-multiplier
81   0%                       + yant/format-summary-for-agenda
10   0%                      + if
40   0%                     replace-regexp-in-string
10   0%                     org-get-time-of-day
3185  15%                  - org-get-tags
3095  14%                   + org-up-heading-safe
20   0%                     org--get-local-tags
20   0%                   + org-before-first-heading-p
10   0%                   + mapcar
10   0%                   + org-remove-uninherited-tags
1410   6%                  - org-buffer-substring-fontified
1380   6%                   + jit-lock-fontify-now
362   1%                    org-get-priority
39   0%                    org-add-props
20   0%                    org-get-todo-state
10   0%                    org-agenda-skip
10   0%                    replace-regexp-in-string
9   0%                    org-agenda-new-marker
5400  25%            - org-agenda-finalize
2920  14%             + org-get-tags
1380   6%             + run-hooks
610   2%               org-agenda-fontify-priorities
340   1%             + org-agenda-align-tags
30   0%             + org-activate-links
20   0%             + org-agenda-mark-clocking-task
730   3%            + org-agenda-prepare
150   0%            + org-agenda-finalize-entries
80   0%            + org-fold-core--fix-folded-region
59   0%         + org-agenda-get-restriction-and-command


  reply	other threads:[~2021-05-04  4:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 12:11 prettify-symbols-mode in org agenda? William Xu
2020-11-03  5:05 ` Ihor Radchenko
2020-11-03 19:05   ` William Xu
2020-11-04  1:47     ` Ihor Radchenko
2021-04-27 20:53     ` Bastien
2021-05-01 12:33       ` Ihor Radchenko
2021-05-01 13:33         ` William Xu
2021-05-01 14:37           ` Ihor Radchenko
2021-05-02 12:31             ` William Xu
2021-05-02 12:58               ` Ihor Radchenko
2021-05-02 13:56                 ` William Xu
2021-05-03 17:16                 ` Bastien
2021-05-04  4:23                   ` Ihor Radchenko [this message]
2021-05-04 14:51                     ` Ihor Radchenko
2021-05-05 15:23                       ` Ihor Radchenko
2021-05-05 18:01                         ` William Xu
2021-05-06  2:15                           ` Ihor Radchenko
2021-05-14 15:35                             ` William Xu
2021-05-15 12:15                               ` Ihor Radchenko
2021-05-16  9:49                                 ` William Xu
2021-05-17 14:04                                   ` Ihor Radchenko
2021-05-17 17:44                                     ` William Xu
2021-06-20 11:27                                       ` Ihor Radchenko
2021-06-22 15:25                                         ` William Xu
2021-06-22 15:42                                           ` Ihor Radchenko
2021-06-22 18:07                                             ` William Xu
2021-07-02 14:11                                               ` Ihor Radchenko
2021-07-01 15:49                                             ` Timothy
2021-07-02 14:13                                               ` Ihor Radchenko
2021-10-26  9:03                                                 ` William Xu
2021-10-27  6:50                                                   ` 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=87y2cvyvo9.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=william.xwl@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).