From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CMBdJTGp9WIyRwAAbAwnHQ (envelope-from ) for ; Fri, 12 Aug 2022 03:13:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MH10JDGp9WK9XAAAG6o9tA (envelope-from ) for ; Fri, 12 Aug 2022 03:13:21 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EAC6E1EF72 for ; Fri, 12 Aug 2022 03:13:20 +0200 (CEST) Received: from localhost ([::1]:57288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMJEk-0003wF-TL for larch@yhetil.org; Thu, 11 Aug 2022 21:13:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMJE2-0003w7-QR for emacs-orgmode@gnu.org; Thu, 11 Aug 2022 21:12:34 -0400 Received: from [39.171.214.252] (port=14704 helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMJDz-0000zb-9q for emacs-orgmode@gnu.org; Thu, 11 Aug 2022 21:12:34 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id CAEAA5E6F68E; Fri, 12 Aug 2022 09:12:13 +0800 (CST) User-agent: mu4e 1.8.6; emacs 28.1 From: "Christopher M. Miles" To: Org Mode (org-mode) Subject: [PERFORMANCE] Why some org code is so deep invoked? Date: Fri, 12 Aug 2022 08:26:40 +0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 39.171.214.252 (deferred) Received-SPF: softfail client-ip=39.171.214.252; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 81 X-Spam_score: 8.1 X-Spam_bar: ++++++++ X-Spam_report: (8.1 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, MSGID_MULTIPLE_AT=1, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_PBL=3.335, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, SPOOFED_FREEMAIL=1.522, SPOOFED_FREEMAIL_NO_RDNS=0.001, SPOOF_GMAIL_MID=0.799, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: reject X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: numbchild@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1660266801; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=VQgNpWpW5u6RateyCrTO4FAyCjKQbUJ9YJvDWEdx34s=; b=gnyHzeCi0nH7Psl0NDA7KWr8NDsDDDShIffrhAZTx4pUKC9LweNV6RB/0ulEPamf8TFJ5r A7DDRffF7pkefyCIzkWoC5TZlcUtna37VM6TEOKahyTESjNbaxUhPzKUf8i3Vplv+mAZpg UG9PBv3h1Rh9sVLntHFu5UAcqpB+Klw8/369zi1yDwk+pBnV2m+FaB+/Dm5rgJRKwAvXxb kJ0OSEuNxJ1SpTEPLQ0eR7toLHDviK4+TUx9cUYlUWhu7njo+HBFmduDSnv/4e1fjKVjL6 xvSB9jBPBdW+dBBdeymeTVljdxBOttYLBPJcCZPtyhL1QWjwgWjKoJhCL/rbcA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660266801; a=rsa-sha256; cv=none; b=NRDUvTUFzR60DYMD/LPfFze5gkVvfNPDJmiYeyGIqgsUlrgSAWLBTyh68nkX8DqsMqfBQe haFmjfAnaF/ytGiJIJze9BQSFDB+2DSfvRCfTnO3bmqbW7iNZuScVUStPJo0l/tcq783gR NOiYsiZPQGcK8iL5PipSHf+O+KNy3lq8EPELU/vyKWOMLWdiBHdKa+DI6QIWs342X8ndMH G/3C5iT3lZCB6ZqFDwcOiQVmzKN8VIqzCC3LPfF5A4cM8rlWMtO+lcg7i1QZczhT5wyMq0 x7lkI+Ts4OmIYNFLhX8DTtkb0eQETvDDGPi3EQPKM2H9WRFfRyTWXJxZziWi2A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.72 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EAC6E1EF72 X-Spam-Score: 1.72 X-Migadu-Scanner: scn0.migadu.com X-TUID: VAg3ehxj9ile --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=profiler-cpu-report.log Content-Description: profiler-cpu-report.log 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% - # 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% + # 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 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=profiler-memory-report.log Content-Description: profiler-memory-report.log 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 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 [ 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 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmL1qO0ACgkQG13xyVro msPLtAgAmQ8sCJDbM5pXV8GydfIAXBGfw41dTbTXMA0jymS4xmuOYzCwIn5p8bfh gPQ4atCuIkDezYFVE4ZrJZYvI/oxCDNEY1MH6gi6cuyECi9cy+aSVqZE56Crwe6R BvRtfAmjolvdKC0K+PFg5zxhM326v6b+WbD2X9+Ubmrc6wkCGOeRGoBXLMdOhHvX SlmAFSFZ0f51ZWKPqLQ2l9r4kU4Y1aEg3512qxf+LZaQhdcPzmw3ofQo0WWMmcDH afclvCOuS+nMOG6Isj1XB/3lpNTrqMcnQYq2KSAOqlCHrbpnhiuaZeqL4do0EuYy mXfU1Ovft4ThQVsQNlUiWJYZminOkQ== =qpMM -----END PGP SIGNATURE----- --==-=-=--