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 6JAPBO9R9mKmLwAAbAwnHQ (envelope-from ) for ; Fri, 12 Aug 2022 15:13:19 +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 ADdNA+9R9mKqWQAAG6o9tA (envelope-from ) for ; Fri, 12 Aug 2022 15:13:19 +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 A8D4D2FEB2 for ; Fri, 12 Aug 2022 15:13:18 +0200 (CEST) Received: from localhost ([::1]:59424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMUTV-0001Xv-0i for larch@yhetil.org; Fri, 12 Aug 2022 09:13:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMUSC-0001W2-Rb for emacs-orgmode@gnu.org; Fri, 12 Aug 2022 09:11:56 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:51936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMUSB-0001VU-5y for emacs-orgmode@gnu.org; Fri, 12 Aug 2022 09:11:56 -0400 Received: by mail-pj1-x1029.google.com with SMTP id t22so981371pjy.1 for ; Fri, 12 Aug 2022 06:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=C5LydUvZLLE9Uij8EIDf6FugBHUlBfAxgG6F5W4Of74=; b=YaCte3y6w5JV5mF4KNgxvzAo0QOs97o9KoHQK8ub4mY/1w9TKW8h2If2tnfa3Rpbp2 830M9dLOVlVVCfUAAAXaFqHeBq7rbXbFKwZMZDz7e7G3b4BNDaSkKlmSqB03O8phfldg VzkJr3T1qVrXPNyj4m6oQBvv2GAiToiRzlv41C9r5fSNStftWLfzsv7znVHe+1OpzafL jST7L2ApIJKijpIWsJf57TnQoF2uMCIi2kPDNqMYDIcE5yT5NoVvUrm1mbj7Z2MwbjrV Mqtv/ZDjXia36o9XbtxzsKQuocB6SdMa5D+REgAZNdSg7G8z6xn35TBWmF6Gd6Yo7D1u 1fQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=C5LydUvZLLE9Uij8EIDf6FugBHUlBfAxgG6F5W4Of74=; b=mazbLKL1udnbqUfRW/bTbsL6iiP8fpisWqhXobQyG0XP4fUTF1gG8IC8oNKbyOyqC+ t76BNDdBu3OHPGEwe4aRPoAM50EbtiPVEq0RiDK9xzvVicQVPUPSma5il3yVB+KCq8ZF vjYz8dDPUu+KwypFNLDahjGQmr+sOEXoXcfI3q1d++qaECppuhF7w1vPfcxw0ZVGPLhA dhwj27UaMEf3grVbQHtqIPUNNh3H5n/2+dpKbIsHfzPC6V0qMz12rRRPUSsPFKsxhbXd ckDQePPS/VR35V7WUtWbroDTbvivaAbUj6GarCJImjGPzdyUMUntJ1Ku9QiLfWQNDqJ+ etaA== X-Gm-Message-State: ACgBeo1nV6YCOuG42eQTtqh3wP7ZXleG6z5GTyh9Bm5mrL83PEuOGBPK bPk+6b17sXYW2Ad5QyVWT1A= X-Google-Smtp-Source: AA6agR4QHY5+JsbBlkaQrJUwbf2YP8EA7eiY4LnIJ1O2mC208sH7WCchUEf019MDvKHoCOhqPSGUbA== X-Received: by 2002:a17:902:c94c:b0:16e:ce7d:1fe with SMTP id i12-20020a170902c94c00b0016ece7d01femr3985710pla.168.1660309913686; Fri, 12 Aug 2022 06:11:53 -0700 (PDT) Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id z6-20020a1709027e8600b0016d7afee272sm1659903pla.153.2022.08.12.06.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 06:11:53 -0700 (PDT) From: Ihor Radchenko To: "Christopher M. Miles" Cc: Org Mode Subject: Re: [PERFORMANCE] Why some org code is so deep invoked? In-Reply-To: <62f645de.050a0220.ff872.76ffSMTPIN_ADDED_BROKEN@mx.google.com> References: <62f5a905.c80a0220.1f07b.ffaeSMTPIN_ADDED_BROKEN@mx.google.com> <87o7wq8c1m.fsf@localhost> <62f645de.050a0220.ff872.76ffSMTPIN_ADDED_BROKEN@mx.google.com> Date: Fri, 12 Aug 2022 21:12:56 +0800 Message-ID: <87h72h8v1j.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1029.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , 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=1660309998; h=from:from:sender:sender: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:dkim-signature; bh=C5LydUvZLLE9Uij8EIDf6FugBHUlBfAxgG6F5W4Of74=; b=OWPYxFzb5jUzh1XiM16uLVSuMlqFZXtT8b8hJHS8/qFdwml35a5c5XLyOVh5KcHZ0BGevc c43p3C8bJynSkjFHa/u9Fswmp658T8Rnz6R6OwCCCuEZkpVbQTUphE1+ARMQ4DEIeCEpSx b9ZQitcqcwtQEs/QzNOhZZux0yN2dmSM9EGYsYkM2vUEYWVQ2DIp7oCA4WhBZYBkkYkeyN BfxRVrxhQ4QUHEYHCTTDBuEMVkGvlw1PeaPSjao4Rt/NrntUH/e0eYiPDVl3uH6XDNi6p1 9TW6742/B6hKfeFjt1dNHpEqBIHMB53Qg1AOkdN592ESemoqMG+EeBHVtuhWGg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660309998; a=rsa-sha256; cv=none; b=Fb6OwKDHwH+WDGRjQL1dc1fv+LbT/JEQm46D/9uyP1nm3LM/EyCmIEQqQ791tV+WCny4IX 4Yyhd4ppRa0eTMf2dMtbFbtzEhWAuqJl/El+8doQE4Ker1bX9F9RMOmKISo288KLm9g+7C spKFSdEKbSA1M/OiWBTfVhsUWHDtWikyLhf8MR3U5H0gs850zYR7VMVQPMoxy6aNKAgu1D oLQwx47z3Y1mGqGpgeh9tNaAwJkIKJ2wG0uCYa8nC8YYDxoKkSNLYpHUpUse/cIJVz+cku TvFBeEMtVvTpk3fNQHkLGaMH4QGAFrR07Xw7eHwAxdZQ+xBPdb4XPYthIQ4OkQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YaCte3y6; dmarc=pass (policy=none) header.from=gmail.com; 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: -5.97 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YaCte3y6; dmarc=pass (policy=none) header.from=gmail.com; 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: A8D4D2FEB2 X-Spam-Score: -5.97 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6LuKVUsD6PSg "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. >> 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. 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 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. -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92