From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WOEMN89g9mIWkAAAbAwnHQ (envelope-from ) for ; Fri, 12 Aug 2022 16:16:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id uMJTNs9g9mK0NgEAG6o9tA (envelope-from ) for ; Fri, 12 Aug 2022 16:16:47 +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 B70E63D828 for ; Fri, 12 Aug 2022 16:16:46 +0200 (CEST) Received: from localhost ([::1]:51580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMVSv-00061q-TX for larch@yhetil.org; Fri, 12 Aug 2022 10:16:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMVSE-00060W-0H for emacs-orgmode@gnu.org; Fri, 12 Aug 2022 10:16:02 -0400 Received: from [2409:8a28:603f:af40:52d2:f5ff:fe16:c591] (port=57270 helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMVSB-0004Lr-Mx for emacs-orgmode@gnu.org; Fri, 12 Aug 2022 10:16:01 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id D39145E88897; Fri, 12 Aug 2022 22:15:50 +0800 (CST) References: <62f5a905.c80a0220.1f07b.ffaeSMTPIN_ADDED_BROKEN@mx.google.com> <87o7wq8c1m.fsf@localhost> <62f645de.050a0220.ff872.76ffSMTPIN_ADDED_BROKEN@mx.google.com> <87h72h8v1j.fsf@localhost> User-agent: mu4e 1.8.6; emacs 28.1 From: "Christopher M. Miles" To: Ihor Radchenko Cc: "Christopher M. Miles" , Org Mode Subject: Re: [PERFORMANCE] Why some org code is so deep invoked? Date: Fri, 12 Aug 2022 22:12:33 +0800 In-reply-to: <87h72h8v1j.fsf@localhost> 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 2409:8a28:603f:af40:52d2:f5ff:fe16:c591 (deferred) Received-SPF: softfail client-ip=2409:8a28:603f:af40:52d2:f5ff:fe16:c591; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 25 X-Spam_score: 2.5 X-Spam_bar: ++ X-Spam_report: (2.5 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, SPOOFED_FREEMAIL_NO_RDNS=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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=1660313806; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=m6afob0/i9dNZR3IQ5kDfqsPir/hQegZNIh8IMmn3eo=; b=GvJHT2+0U2MVgDl/JAIpcUgXtrnH1CW+uGpgk1poCpH2O0ZXNX1xOgDiHPUmpCdPEe6XtA zQpIU2NDAd43bxh2y462RulI5HHzxa/OnjP1o6oyfRUmnjOy8GQQUcQAbHuQEXDhrMOqMS IDa5LuW4EeHqWpj4tBxO+PrImv+nCHel9TtMdAHksbeHXk2k+Erniu4Ca+qouaqw7Ui2Dc uZpbvO7ibuyiVb0cEtLLaHUIpTj/s8jk1bWbPFEbdzNz2BbArNLoAibCaRP1Y1F+Maab+y 9s9qZ9mP1U4Cff+RgUjixWF6DWSN3ctvbpqjOFq/zfqkLPqN9pj5GgUCR1UenA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660313806; a=rsa-sha256; cv=none; b=Egdnts5opykBQcXn56JG9NnaRrcGNd887AhQCT3eH3/O+kuoeeDCr7HpVS/LVspgpUsE3X WpcViMJlgaoLGY92rLI2zZjCbPCK/vYjJi6YllWq6roaa+sWDONP9xUXwm8SvDiPYN3pTA 53hzQZ/O9YLj2kx/jjfB4TOcvVt81aHKpjDShxRVDqUBcWZ52HEW+YT4OFsD929e8kcNac GO06ch+k2ccnB9wU6SZOBi/14kcir0a3Eij7kEvBEjd7TyQnZDOCTFwOsepBKekyHdAxiC h1RexwYOBlQi+roZcFo3Y1rwMRncyLL2/7IKhglpur9QRX0RIO+p/6xyK7dKBw== 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: 3.23 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: B70E63D828 X-Spam-Score: 3.23 X-Migadu-Scanner: scn0.migadu.com X-TUID: vDlWjvhx4nAB --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Ihor Radchenko writes: > "Christopher M. Miles" writes: > >>> I do not see much issue with deep nesting of the code. >> >> Is this deep nested code normal in Emacs Lisp? >> >> Usually (based on my less than 20 times profiling experience), Emacs >> wouldn't have deeper code than 40 levels. But my attachment profiler >> report has more than 100 levels. >> >> If this is normal and fine, It's OK. I repeat, I ask this question for >> curious purpose which want to get an answer for not important question. > > It depends. You are looking at the complex code here, which is not > necessarily common. > > However, lisp nesting is tangent to performance. Shallow nesting can be > slow while deep nesting can be fast. Or vice versa. > I see, thanks for answering. >>> Could you please clarify what exactly is your problem? >>> Is agenda generation slow? >> >> From the profiler report, you can see that Agenda is slow on clock table >> generation because I have ~org-agenda-start-with-clockreport-mode~ >> enabled. And this deep code invocation is from it too. It's about 5 >> seconds to generate the org-agenda clock table. Actually I can tolerate >> this time, Just found this performance issue when profiling and curious >> to ask this question. > > Note that your profiler result does not look like taken from a 5 > second-lasting code: > > 390 13% - completing-read > > Completing read takes >10% *CPU time* of the 5 seconds? Suspicious. I'd > retry to get the profile. I re-profiled three times, around 4 seconds. > > Also, I suggest to use M-x write-file in the profiler buffer when > sharing something as deeply nested as you got. The resulting file is > much more comfortable to view - it will preserve all the actual profiler > data. I see, I tried it, it indeed kept the profiler data! > > I will refrain from trying to deduce anything from the profiler for now. > > Please try to reproduce the report again and share it with us. Then, I > will try to see if we can do anything on the Org side. Ok, I attached the new generated profiler reports. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=profiler-cpu-report-2.log 1284 57% + command-execute 935 41% + ... 21 0% + timer-event-handler 2 0% + redisplay_internal (C function) --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=profiler-memory-report-2.log 410,957,330 97% - command-execute 410,957,330 97% - call-interactively 405,537,622 95% - funcall-interactively 331,652,432 78% - org-agenda-redo-all 331,652,432 78% - if 331,651,376 78% - org-agenda-redo 331,651,376 78% - let* 331,649,112 78% - if 331,649,112 78% - progn 331,649,112 78% - let* 331,649,112 78% - eval 331,649,112 78% - let 331,649,112 78% - funcall 331,649,112 78% - # 331,649,112 78% - eval 331,649,112 78% - org-agenda-list 331,649,112 78% - catch 299,277,191 70% - let* 213,251,714 50% - if 213,105,362 50% - progn 213,105,362 50% - let 212,941,062 50% - setq 212,940,006 50% - apply 212,940,006 50% - org-clock-get-clocktable 212,940,006 50% + let 1,056 0% + org-plist-delete 124,712 0% + org-agenda-files 16,584 0% insert 7,764 0% + if 58,632 0% + or 19,576 0% + if 3,136 0% + let* 78,430,580 18% + while 7,306,892 1% + org-agenda-finalize 148,040 0% add-text-properties 139,819 0% + org-agenda-files 48 0% + org-today 32,366,705 7% + org-agenda-prepare 4,160 0% + org-compile-prefix-format 1,024 0% + or 1,056 0% + turn-on-ligature-mode 35,958,904 8% + eyebrowse-create-window-config 30,440,458 7% + org-agenda 6,646,049 1% delete-window 839,779 0% + execute-extended-command 5,419,708 1% + byte-code 11,917,712 2% + redisplay_internal (C function) 280,655 0% + ... 1,984 0% + timer-event-handler 1,152 0% + corfu--auto-post-command 80 0% flyspell-post-command-hook 80 0% + indent-guide-pre-command-hook 80 0% + flycheck-maybe-display-error-at-point-soon --=-=-= 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 without mi= sunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmL2YJMACgkQG13xyVro msP5AQgAqhnL8ktLOIlS5/py/1LBqPnvZTzpoHBZrfZCpO+iHRZ8N99V6H46/twC dsSKkg2hj45f6LjK0XCG84jM5L3PTju8btwLDfIMaHrhbhGpBhmWl1kbIYtu2mMH rRz61u6VjJbv4ZNHOhpGlF7iXlzx/u3eZoNw+VH7ylYFwjnAECjVWUvCZV/VMEAF QkCwM2zFZWTiGwRMkvh/uM606ypRX4IIojvSZ/MOBAhzE5GmThE+9CGNa9STt6Q3 t9EVdNjE9gmXYM/YMBx01Fuhemqzl9ubzxXEBukWcQeGn+awTjOdSIJa5GFiIWFI QPPiTpmedOfCFqmRigf5CooPRt1K9A== =Fq6Z -----END PGP SIGNATURE----- --==-=-=--