From: "Christopher M. Miles" <numbchild@gmail.com>
To: Org Mode (org-mode) <emacs-orgmode@gnu.org>
Subject: [PERFORMANCE] Why some org code is so deep invoked?
Date: Fri, 12 Aug 2022 08:26:40 +0800 [thread overview]
Message-ID: <m2leruxo2a.fsf@numbchild@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1176 bytes --]
When I profiling Org Agenda generation, I found that org code is deeply invoked in Emacs profiler report.
My Question:
- What reason caused this situation?
- Can Org Mode optimize those deeply invoked code?
I have option ~org-agenda-start-with-clockreport-mode~ enabled. And have lot files in ~org-agenda-files~ list:
#+begin_src emacs-lisp
(length org-agenda-files)
#+end_src
#+RESULTS[(2022-08-12 08:29:28) 1c2c57fd8db39360b33abd3465e5ebb26c817627]:
: 46
And here is those files lines size:
#+begin_src emacs-lisp :results value verbatim
(sort
(let ((return '()))
(dolist (file org-agenda-files
return)
(when-let ((buffer (get-buffer (file-name-nondirectory file))))
(with-current-buffer buffer
(setf return
(add-to-list 'return (count-lines (point-min) (point-max))))))))
'>)
#+end_src
#+RESULTS[(2022-08-12 09:03:07) 2af183ec8f3ea19e280dc2c53e861b75c3e42b7a]:
: (25455 12361 11772 10938 9530 8506 4457 3752 2316 2041 1277 1216 1196 1163 1006 1005 878 762 689 685 657 510 378 353 316 268 228 226 197 143 133 94 93 78 68 46 44 39 38 36 34 20 18 17 14 0)
Here is the Emacs profiler reports in attachments:
[-- Attachment #1.2: profiler-cpu-report.log --]
[-- Type: text/plain, Size: 25850 bytes --]
1618 56% - command-execute
1618 56% - call-interactively
1228 42% - funcall-interactively
1224 42% - org-agenda
1224 42% - catch
1224 42% - let*
1193 41% - cond
1193 41% - call-interactively
1193 41% - funcall-interactively
1193 41% - org-agenda-list
1193 41% - catch
1119 39% - let*
1077 37% - if
1074 37% - progn
1074 37% - let
1073 37% - setq
1073 37% - apply
1073 37% - org-clock-get-clocktable
1073 37% - let
1073 37% - save-current-buffer
1073 37% - unwind-protect
1073 37% - progn
1072 37% - org-update-dblock
1072 37% - save-excursion
1072 37% - let*
1069 37% - funcall
1069 37% - org-dblock-write:clocktable
1069 37% - catch
1069 37% - let*
1033 36% - org-agenda-prepare-buffers
1033 36% - let
1032 35% - let
1032 35% - while
1032 35% - let
1032 35% - catch
1032 35% - save-current-buffer
999 34% - save-excursion
999 34% - save-restriction
577 20% - or
547 19% - org-refresh-stats-properties
547 19% - let*
547 19% - unwind-protect
547 19% - progn
547 19% - let
547 19% - save-excursion
547 19% - save-excursion
547 19% - save-restriction
547 19% - let
537 18% - progn
537 18% - let*
537 18% - let
537 18% - while
537 18% - let
536 18% - cond
459 16% - if
459 16% - progn
459 16% - let
443 15% - unwind-protect
443 15% - progn
441 15% - if
441 15% - if
441 15% - and
437 15% - org-in-archived-heading-p
437 15% - cond
437 15% - if
437 15% - let
437 15% - org-get-tags
437 15% - let
437 15% - unwind-protect
437 15% - progn
437 15% - if
437 15% - let
437 15% - save-excursion
437 15% - save-excursion
437 15% - save-restriction
431 15% - org-get-tags
431 15% - let
431 15% - unwind-protect
431 15% - progn
431 15% - if
431 15% - let
430 14% - save-excursion
430 14% - save-excursion
430 14% - save-restriction
430 14% - if
429 14% - or
429 14% - org-before-first-heading-p
429 14% - let
427 14% - org-element-at-point
426 14% - let
426 14% - setq
426 14% - if
426 14% - condition-case
426 14% - org-element--parse-to
426 14% - catch
426 14% - let
426 14% - unwind-protect
426 14% - progn
426 14% - save-excursion
426 14% - save-restriction
425 14% - let*
220 7% - let
217 7% - while
195 6% - if
195 6% - if
195 6% - let*
194 6% - unwind-protect
194 6% - progn
194 6% - setq
194 6% - org-element--current-element
192 6% - let*
192 6% - if
191 6% - save-excursion
184 6% - let
183 6% - setq
183 6% - cond
133 4% - org-element-headline-parser
133 4% - save-excursion
132 4% - let*
89 3% - save-excursion
89 3% - let
84 2% if
5 0% - rx-to-string
5 0% - rx--translate
5 0% - rx--translate-form
5 0% - rx--translate-seq
5 0% - mapcar
5 0% - rx--translate
5 0% - rx--translate-form
5 0% - rx--translate-**
5 0% - rx--translate-bounded-repetition
3 0% - rx--translate-counted-repetition
2 0% - rx--translate-seq
2 0% - mapcar
1 0% rx--translate
16 0% - and
5 0% - let
4 0% looking-at
4 0% progn
6 0% - org-element--get-time-properties
6 0% - save-excursion
6 0% - if
6 0% - progn
6 0% - let
6 0% - while
3 0% - let
3 0% - org-element-timestamp-parser
3 0% - if
3 0% looking-at-p
6 0% - org-element--get-node-properties
6 0% - save-excursion
5 0% - if
3 0% - progn
3 0% - let
3 0% - while
2 0% - let*
1 0% - cond
1 0% setq
1 0% + concat
1 0% <
1 0% if
5 0% + if
4 0% + org-trim
3 0% + org-reduced-level
1 0% + let
17 0% + progn
13 0% + org-element-section-parser
13 0% + org-element-planning-parser
2 0% + let
2 0% + and
1 0% + if
21 0% - let
19 0% - cond
13 0% - let
11 0% - if
11 0% - progn
10 0% - setq
10 0% - if
8 0% - org-element--open-end-p
8 0% - and
7 0% - =
7 0% save-excursion
1 0% org-element-property
1 0% + org-element-property
1 0% + org-element--next-mode
1 0% goto-char
5 0% + if
1 0% org-element-property
2 0% or
1 0% + org-element-property
205 7% + cond
1 0% save-excursion
1 0% + setq
2 0% + if
1 0% + org-back-to-heading
1 0% + let
6 0% + let
4 0% + re-search-forward
2 0% + font-lock-ensure
16 0% + save-current-buffer
77 2% + let
1 0% + setq
10 0% + while
21 0% + org-refresh-category-properties
5 0% + if
4 0% + org-refresh-properties
389 13% - setq
388 13% - org--tag-add-to-alist
388 13% - cond
388 13% - let
375 13% - let
373 13% - while
346 12% - let
281 9% - let*
262 9% - if
214 7% - let*
160 5% - cond
91 3% - funcall
57 1% - #<lambda -0x147358dab69cc749>
50 1% - if
32 1% - progn
21 0% setq
8 0% memq
2 0% - let*
2 0% - if
2 0% let
8 0% setq
4 0% append
19 0% + if
14 0% + org-set-regexps-and-options
33 1% + set-buffer
1 0% + setq
35 1% - let
35 1% - if
35 1% + mapcar
1 0% + cond
1 0% + org-mode
1 0% + if
2 0% + or
23 0% + org-agenda-finalize
17 0% + while
1 0% + org-agenda-files
1 0% + add-text-properties
74 2% + org-agenda-prepare
31 1% + if
4 0% + execute-extended-command
390 13% - byte-code
390 13% - read-extended-command
390 13% - completing-read
390 13% - completing-read-default
390 13% - apply
390 13% - vertico--advice
390 13% - apply
390 13% + #<compiled 0x1293d8292736c8ca>
1237 43% - ...
1228 42% Automatic GC
9 0% + org-fold-core-get-region-at-point
10 0% + timer-event-handler
2 0% + indent-guide-post-command-hook
[-- Attachment #1.3: profiler-memory-report.log --]
[-- Type: text/plain, Size: 20458 bytes --]
387,611,107 96% - command-execute
387,611,107 96% - call-interactively
385,948,976 96% - funcall-interactively
385,094,384 96% - org-agenda
385,094,384 96% - catch
385,094,384 96% - let*
334,045,167 83% - cond
334,045,167 83% - call-interactively
334,045,151 83% - funcall-interactively
334,045,151 83% - org-agenda-list
334,045,151 83% - catch
304,886,515 76% - let*
284,838,884 71% - if
284,738,980 71% - progn
284,738,980 71% - let
282,798,755 70% - setq
282,798,755 70% - apply
282,798,755 70% - org-clock-get-clocktable
282,798,755 70% - let
282,798,734 70% - save-current-buffer
282,798,734 70% - unwind-protect
282,798,734 70% - progn
282,693,307 70% - org-update-dblock
282,693,307 70% - save-excursion
282,693,307 70% - let*
282,687,999 70% - funcall
282,687,999 70% - org-dblock-write:clocktable
282,687,999 70% - catch
282,687,999 70% - let*
279,158,805 69% - org-agenda-prepare-buffers
279,158,805 69% - let
278,877,973 69% - let
278,877,973 69% - while
278,877,973 69% - let
278,877,973 69% - catch
278,877,973 69% - save-current-buffer
278,523,342 69% - save-excursion
278,523,342 69% - save-restriction
215,652,704 53% - or
215,567,272 53% - org-refresh-category-properties
215,567,272 53% - if
215,567,272 53% - let
215,442,226 53% - let
215,367,122 53% - let*
215,367,122 53% - unwind-protect
215,367,122 53% - progn
215,367,122 53% - save-excursion
215,367,122 53% - save-restriction
215,367,122 53% - let
215,356,826 53% - while
215,089,585 53% - let
215,089,585 53% - if
214,048,377 53% - org-at-property-p
214,048,377 53% - save-excursion
214,048,377 53% - and
214,023,179 53% - let
214,022,123 53% - let
214,014,731 53% - unwind-protect
214,014,731 53% - progn
214,013,675 53% - org-get-property-block
214,013,675 53% - save-excursion
214,013,675 53% - save-restriction
214,013,675 53% - let
214,013,675 53% - cond
213,189,659 53% - org-before-first-heading-p
213,189,659 53% - let
213,175,931 53% - org-element-at-point
213,174,875 53% - let
213,171,707 53% - setq
213,171,707 53% - if
213,171,707 53% - condition-case
213,170,651 53% - org-element--parse-to
213,170,651 53% - catch
213,168,539 53% - let
213,167,483 53% - unwind-protect
213,167,483 53% - progn
213,167,483 53% - save-excursion
213,167,483 53% - save-restriction
213,165,371 53% - let*
109,701,502 27% - let
109,672,990 27% - while
101,096,614 25% - if
101,030,086 25% - if
100,974,118 25% - let*
100,960,390 25% - unwind-protect
100,960,390 25% - progn
100,960,390 25% - setq
100,888,582 25% - org-element--current-element
100,815,718 25% - let*
100,796,710 25% - if
100,762,918 25% - save-excursion
100,736,518 25% - let
100,615,078 25% - setq
100,615,078 25% - cond
69,763,927 17% - org-element-headline-parser
69,763,927 17% - save-excursion
69,743,863 17% - let*
37,677,026 9% - org-element--get-time-properties
37,677,026 9% - save-excursion
37,677,026 9% - if
37,677,026 9% - progn
37,677,026 9% - let
37,677,026 9% - while
36,442,130 9% - let
36,409,394 9% - org-element-timestamp-parser
36,409,394 9% - if
34,038,436 8% - progn
34,038,436 8% - save-excursion
34,038,436 8% - let*
18,705,788 4% - and
122,760 0% - list
81,840 0% - let*
81,840 0% string-to-char
24,552 0% let
16,368 0% string-to-number
8,335,203 2% - progn
1,440,384 0% looking-at
302,808 0% match-string-no-properties
6,561,412 1% - if
6,559,300 1% - let
6,557,188 1% - org-parse-time-string
5,930,980 1% if
621,984 0% - list
482,856 0% string-to-number
139,128 0% - cond
139,128 0% string-to-number
425,568 0% match-string-no-properties
8,448 0% + list
2,370,958 0% looking-at-p
7,788,408 1% + org-trim
7,450,859 1% + org-element--get-node-properties
6,227,446 1% + and
6,022,480 1% + if
4,547,720 1% + save-excursion
20,064 0% + let
9,372,144 2% + progn
5,006,952 1% + org-element-section-parser
4,631,816 1% + and
3,821,834 0% + let
2,298,989 0% + org-element-planning-parser
409,984 0% + org-element-property-drawer-parser
181,456 0% + org-element-node-property-parser
30,720 0% + org-element-clock-parser
14,336 0% + org-element-comment-parser
121,440 0% + if
21,120 0% let*
19,008 0% and
21,120 0% + setq
14,784 0% + or
14,784 0% + org-element-put-property
8,538,360 2% + let
8,448 0% or
103,450,141 25% + cond
9,504 0% and
3,168 0% + if
11,616 0% + if
416,744 0% + or
227,536 0% + progn
178,680 0% + if
1,041,208 0% + progn
8,184 0% + org-re-property
75,104 0% + catch
125,046 0% + cond
84,376 0% + org-refresh-properties
48,466,079 12% + setq
12,004,719 3% + if
2,397,384 0% + org-set-regexps-and-options
354,631 0% + set-buffer
280,832 0% + setq
3,401,731 0% + let
127,463 0% + cond
4,096 0% + org-prepare-dblock
74,440 0% + font-lock-ensure
17,051 0% + org-create-dblock
12,912 0% + org-mode
1,024 0% + buffer-substring
21 0% generate-new-buffer
1,792,298 0% + if
127,463 0% + org-agenda-files
12,280 0% + org-set-regexps-and-options
8,184 0% + org-set-font-lock-defaults
42,200 0% + or
1,024 0% + let*
1,016 0% + if
19,440,190 4% - org-agenda-finalize
19,440,190 4% - if
10,426,677 2% - save-current-buffer
10,426,677 2% - save-excursion
10,426,677 2% - save-restriction
10,426,677 2% - let
10,426,677 2% - progn
10,426,677 2% - let*
10,426,677 2% - let
10,426,677 2% - while
10,426,677 2% - let
10,426,677 2% - cond
10,426,677 2% - let
10,426,677 2% - setq
8,998,006 2% - cons
7,401,463 1% - org-agenda-get-scheduled
7,401,463 1% - let*
7,390,971 1% - if
7,390,971 1% - while
6,945,547 1% - catch
6,502,155 1% - let*
2,599,885 0% + save-excursion
2,247,582 0% + let
1,646,504 0% + cond
435,200 0% + org-agenda-skip
8,192 0% + if
8,284 0% + list
1,104 0% + org-today
1,104 0% + org-agenda-today-p
664,547 0% + org-agenda-get-timestamps
342,498 0% + org-agenda-get-blocks
310,697 0% + org-agenda-get-sexps
278,801 0% + org-agenda-get-progress
1,428,671 0% + org-agenda-get-deadlines
9,013,513 2% + let
450,882 0% + while
133,325 0% + org-agenda-files
23,112 0% add-text-properties
24 0% + org-today
29,156,588 7% + org-agenda-prepare
2,048 0% + org-compile-prefix-format
50,444,705 12% + if
604,512 0% + org-get-tags
838,144 0% + execute-extended-command
16,448 0% + handle-focus-in
1,662,131 0% + byte-code
12,146,879 3% + ...
56,948 0% + redisplay_internal (C function)
51,744 0% + indent-guide-post-command-hook
80 0% + indent-guide-pre-command-hook
80 0% + flycheck-maybe-display-error-at-point-soon
24 0% + eldoc-schedule-timer
[-- Attachment #1.4: Type: text/plain, Size: 229 bytes --]
--
[ stardiviner ]
I try to make every word tell the meaning that I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
next reply other threads:[~2022-08-12 1:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 0:26 Christopher M. Miles [this message]
[not found] <62f5a905.c80a0220.1f07b.ffaeSMTPIN_ADDED_BROKEN@mx.google.com>
2022-08-12 1:51 ` [PERFORMANCE] Why some org code is so deep invoked? Ihor Radchenko
2022-08-12 12:14 ` Christopher M. Miles
[not found] ` <62f64617.050a0220.b0be5.b717SMTPIN_ADDED_BROKEN@mx.google.com>
2022-08-12 12:51 ` Bill Burdick
2022-08-12 14:16 ` Christopher M. Miles
[not found] ` <62f645de.050a0220.ff872.76ffSMTPIN_ADDED_BROKEN@mx.google.com>
2022-08-12 13:12 ` Ihor Radchenko
2022-08-12 14:12 ` Christopher M. Miles
[not found] ` <62f660a5.1f0a0220.73d8b.c78bSMTPIN_ADDED_BROKEN@mx.google.com>
2022-08-12 14:23 ` Ihor Radchenko
2022-08-12 14:30 ` Christopher M. Miles
[not found] ` <62f66552.050a0220.ed346.ac05SMTPIN_ADDED_BROKEN@mx.google.com>
2022-08-13 6:50 ` Ihor Radchenko
2022-08-13 8:10 ` Christopher M. Miles
[not found] ` <62f75d06.c80a0220.460f4.cc42SMTPIN_ADDED_BROKEN@mx.google.com>
2022-08-13 8:48 ` Ihor Radchenko
2022-08-13 13:48 ` Christopher M. Miles
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=m2leruxo2a.fsf@numbchild@gmail.com \
--to=numbchild@gmail.com \
--cc=emacs-orgmode@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 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).