From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id IHtNJsV5MmbxZAAA62LTzQ:P1 (envelope-from ) for ; Wed, 01 May 2024 19:20:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id IHtNJsV5MmbxZAAA62LTzQ (envelope-from ) for ; Wed, 01 May 2024 19:20:05 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=KfSDUv78; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=outlook.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" ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714584005; 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=CtB5aX7UGvrqxYN6Qmu5toaz9qtDi3Cm49mRXbHX+lA=; b=rSscR9d1xPmNuSN19sroItcpVLmxe2WtqvoNmhXGnPqsNkF40Z2ucNXRumANAv4S6v1R5p dgjIB7IGYYBSMWi0Zlz/JfZgfheT3wwFzcha/L5lJaVouAv8JIJEovWn0EmYp+nqT66ctm 7SGyylWR5CBS2Rqaf8i1ZHN0qoCBRFoE76wQ9aWKwY+cbrdFUz82PBc+MIgSMgQM8nOMKY ubS1KqJbtKeX7qAWtYIpdmVvCkuaxltrDU4Y9Q6bSDrS/QvMqGS/merw4fw0iXqGtbsR5j ZuTn/dsZ+E5Tc7fxb2h8Iz4GkYbdonhk8SbLWvxDjgKQtpX5XmOcedVw06bpmQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1714584005; a=rsa-sha256; cv=pass; b=r0tKWVCKTxMR0+x1cl3rX4UtVkmy+rqJCWPcOoXYMSwryy91jdCtdG6M28N+z8yih2a1i0 pw5Zp+BXUEGexVKc6ePQYgvCJJxkc30zVAW+XFaoltKCcYovd1HBZEbfuyFXnSoPIoUQ2F Z+zVEfM2wKAL3jYgjqZ/v6vQrSpm+utPADX6cG0aBKB1Vf8Gu2azYCc5H43CXG9neoSYBt AObCKMQmINNT5Jza7t+znDwfPNp36UYX/zwdD4+XkrM2syX3Dy5qpux0ASNZQ3PcFn5Nzb cmMhmokuQt2Sjqz46+Wc7ESp5IiEMNpbU8/HEFME4TaUHBII/SRYToSd/CeTrg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=KfSDUv78; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=outlook.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" 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 4AEBA71CD8 for ; Wed, 01 May 2024 19:20:05 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2Dc3-0005Nr-Bi; Wed, 01 May 2024 13:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2Dbt-0005NN-I2 for emacs-orgmode@gnu.org; Wed, 01 May 2024 13:19:14 -0400 Received: from mail-bn7nam10olkn20801.outbound.protection.outlook.com ([2a01:111:f403:2804::801] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2Dbr-0007kS-Py for emacs-orgmode@gnu.org; Wed, 01 May 2024 13:19:13 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jUAlIfUzcs/nsrSqspxV0FkrqsuQML0B/Z0bvybfnPHtf+U01HGmukuAO3N0DKOmMqxv2Hf71PxaRCwOb6gr9I9NkQRuTiiTOo+ns6zcR2aXa9BWciKKgW4F8L0vHwE8bazDygxRv3vs4SBQ8yecsp43z+t/XScXgqh51CmpL25e8f/sWp6OVdzhzHXh+eDPGqlxPrG2Mdk6thXMGlgGZtzcy0gEYnZ/lF7XlFf/B3LdvhRJSOczA35EcWBVHJ+zposi3n2tiE+9kFDa78sKir2YlpKmLtiWUG8lYMOhREMSij7gBpqMM5euWwLaxMsmkOpyON15MJGadF9LSIyKSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CtB5aX7UGvrqxYN6Qmu5toaz9qtDi3Cm49mRXbHX+lA=; b=oHPE7MPZ/hPgAzcAMPPKPq5Edbf9f/SSt/CddeHNiM0dQiSKtMM3hgv6LpAizNqXRgA/CJKtjIPdZ2cSoSZjqv/H0XsmRl3ynMcLdh+d2ks6omAfZHiB1/76Qk6iF+Ti3v0TiQoPJg2HdyLfuY7e8OuJd8MElkkDEkfiX4wWMQKvc4fPLpxqc/HjiA5WwAdGW/+LNwLy8bDwt7yw/GRm6cuo6+fVGOAeVHCNq0JtXWHLyNKNLm5nzBx5yUYj+rO+4u0X1MIfQYkrly7ryGhY9p3vKY6pq2RESpToD+dj/NOfzyldEQLtEJkhbtEPVfbuHrYLceR5ib3xuw37mMrFFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CtB5aX7UGvrqxYN6Qmu5toaz9qtDi3Cm49mRXbHX+lA=; b=KfSDUv78sTUzcr/drfqJnmUzcTuD/w2Vk1swaIPXWHou20lx96Gwe2VI6gQW02+64itpwrmJ0NDeQqhv1nF9Gxcb1QRqmIWqxvJvIexcRboPI8OadoXajO5Xz+ykPTIazzzVWyHxZOI/iujDZyGk8OH1hamfXZD9y7hjZy/0MceqngUq5Bw71bug9bPQRGtN4zKbp+3lIlV7X+x+OFsDnm7A2hQocVtGGvdZSdJYhtKv6Ahz2pDaK4nNeG7L1+J/KhA0mcwDIAFXqmIptj2kHFdaT8dDMotvLxyhlEtu3PoGHmT4p1p+Eb355aEkwVTtiNuNDihefkRqKcHd9mKVGw== Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) by SJ0PR84MB1482.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:a03:430::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.32; Wed, 1 May 2024 17:14:07 +0000 Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::178d:1518:8a49:2a45]) by CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::178d:1518:8a49:2a45%6]) with mapi id 15.20.7519.031; Wed, 1 May 2024 17:14:06 +0000 From: Morgan Smith To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/org.el: Obsolete `org-cached-entry-get' in favor of `org-entry-get' In-Reply-To: <877cgfywwg.fsf@localhost> (Ihor Radchenko's message of "Tue, 30 Apr 2024 10:20:31 +0000") References: <87ttjkaywn.fsf@localhost> <877cgfywwg.fsf@localhost> X-Hashcash: 1:20:240501:yantar92@posteo.net::ZOzxFgPxYZ72lryz:0MIT X-Hashcash: 1:20:240501:emacs-orgmode@gnu.org::+7S7rpBAHlrP9+U/:0CH/ Date: Wed, 01 May 2024 13:14:04 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Content-Type: multipart/mixed; boundary="=-=-=" X-TMN: [qNQaAejT19t9A6KOU14V/ED1mdyEN7Oj] X-ClientProxiedBy: YQBPR0101CA0163.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:f::6) To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) X-Microsoft-Original-Message-ID: <87h6fhzc83.fsf@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR84MB3424:EE_|SJ0PR84MB1482:EE_ X-MS-Office365-Filtering-Correlation-Id: 71c53e4d-1a4e-477f-7720-08dc6a021ba7 X-Microsoft-Antispam: BCL:0; ARA:14566002|6092099003|461199019|440099019|3412199016; X-Microsoft-Antispam-Message-Info: Je7gENYeg1bO6CsPVV0ptnQBA3b36BF5twy6hnn9z4AqyWqsfML36EXv8V8tTa0dFTM13r2eZkR1u3/QViGq6o+DdHwGzcA92tl6bZOUPEkNZnH3YZlplV9GFrTKTRpdi2gWuWAwjKD3mjg11GNbbp3zASmZLLUl0ZoeFHkYOatBVLDepa4ttJqEXZJnmcm+P7LQbQ6zbnEYlQMRMli0/6gD9hmYoI85BrjxfTRpia4dThElkogc2BN9+RwTYRnxNSFE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KZUG1fy3L31PQdysZzbIEg3DEOaTzUh8LWfQI9?= =?us-ascii?Q?IIuuv8hfDAvrjaF7T+IDqGnULeIj9vJOLToJhcKoTOc+r20jyvKEWEQ+5Z6T?= =?us-ascii?Q?11QX702W9gWUfCeYY7vxKdfmJzNaBKNHvpqNYc2Fy4V6+m07lxfiY1cd4TmA?= =?us-ascii?Q?bZeAGWTXKOAqpqMA6nM1pQpu9J1xmCl2WBFyl7tBvDqfJ3GqUK1K08sBLBZ9?= =?us-ascii?Q?Y2uAUZUpqrOR6KkbIQ6Dcw287Gyi6TaCbkvvR4Qgnx79Nz4CeDs0voonz/kV?= =?us-ascii?Q?p0nRlzBpCIGRrBmY5ckpNbBwKL7eSE4d3n/ZWxZ7Mpgz/q0qzeq7FIjyLCqn?= =?us-ascii?Q?a+IfEJ5FAqswKwkKU1s8tSU19Kq+eRBgBR/737nU2XCCvCqKq5gp6mcNdb3r?= =?us-ascii?Q?s1yET7WMwFBKlH6Ld2qaRr3FjJOZ60Ps1EH01I6wVMyIeQlBTx7ZBmqqzKsj?= =?us-ascii?Q?WlX1rwrOzZITlH/tYmzwkBXaBa/+DaeclH5Eg39QHcp6aRPaqbBOZbdqavcv?= =?us-ascii?Q?oUPw9dbLQM1TU+Sjlf00VexJcll9qtcesSj2TU5Xt00vEwPeWbDiazdeG6LX?= =?us-ascii?Q?0ODwUgDSx53yCNbXwU5z8bxECLs6qRpzAAIy48D090BPM300uocWjfwmrSEE?= =?us-ascii?Q?7gFxeU0zldeUgIZiaMo3c5LB5f6Hd8GQG5pVmqwrA8HdMUPTcIvHxh4HStu6?= =?us-ascii?Q?kBfj3xgDG4k5pAcRQEhbj8AzeY39vqjvH7o2IF6tliUqHSap6USATKJcuK5o?= =?us-ascii?Q?LiEn7LhTzT0Sp/IE00C5?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71c53e4d-1a4e-477f-7720-08dc6a021ba7 X-MS-Exchange-CrossTenant-AuthSource: CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 17:14:06.8234 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR84MB1482 Received-SPF: pass client-ip=2a01:111:f403:2804::801; envelope-from=morgan.j.smith@outlook.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.85 X-Spam-Score: -6.85 X-Migadu-Queue-Id: 4AEBA71CD8 X-Migadu-Scanner: mx11.migadu.com X-TUID: KavIViZY5IFR --=-=-= Content-Type: text/plain Ihor Radchenko writes: > > However, please move the obsolete function definition to org-compat > instead of removing it completely. We do it to avoid unexpected breakage > for people and libraries who happen to use this public function. Done. See attached > Also, with the old approach, if you observe slowdowns, you likely have > some property being calculated slowly (like BLOCKED in my case). Do you > happen to know which property is it for your setup? According to my profiler, I think it's using 30% of the CPU time during my custom org-clock-sum just to get ITEM. I suppose it's because it thinks it has to grab and cache everything when all I'm after is ITEM. I don't see anything else that looks suspicious in the profiler so I suspect you're seeing a much worse case then I am. I'll copy paste my previous performance numbers here again just so you can see my slowdown is only between 1.5x and 3x. org-cached-entry-get 1st run: 26.868990287 2nd run: 16.043983143 org-entry-get 1st run: 18.209056578 2nd run: 5.003186764 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Obsolete-org-cached-entry-get-in-favor-of-org-entry-.patch >From 5d9cef1250ef1eb656b84d3168ebfecb0e9c9c5c Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Wed, 1 May 2024 12:36:40 -0400 Subject: [PATCH] Obsolete `org-cached-entry-get' in favor of `org-entry-get' We have a better performing cache mechanism in `org-entry-get'. * lisp/org.el (org-make-tags-matcher): Replace uses of `org-cached-entry-get' with `org-entry-get'. (org-cached-entry-get): Move to ... * lisp/org-compat.el (org-cached-entry-get): ... here. Obsolete in favor of `org-entry-get'. --- lisp/org-compat.el | 20 ++++++++++++++++++++ lisp/org.el | 20 ++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 11eb905ee..b73cfc910 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -649,6 +649,26 @@ Counting starts at 1." (define-obsolete-variable-alias 'org-plantuml-executable-args 'org-plantuml-args "Org 9.6") +(defvar org-cached-props nil) +(defun org-cached-entry-get (pom property) + (if (or (eq t org-use-property-inheritance) + (and (stringp org-use-property-inheritance) + (let ((case-fold-search t)) + (string-match-p org-use-property-inheritance property))) + (and (listp org-use-property-inheritance) + (member-ignore-case property org-use-property-inheritance))) + ;; Caching is not possible, check it directly. + (org-entry-get pom property 'inherit) + ;; Get all properties, so we can do complicated checks easily. + (cdr (assoc-string property + (or org-cached-props + (setq org-cached-props (org-entry-properties pom))) + t)))) + +(make-obsolete 'org-cached-entry-get + "Performs badly. Instead use `org-entry-get' with the argument INHERIT set to `selective'" + "9.7") + (defconst org-latex-line-break-safe "\\\\[0pt]" "Linebreak protecting the following [...]. diff --git a/lisp/org.el b/lisp/org.el index 2d1a2055f..36b52b0ab 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11480,22 +11480,6 @@ are also TODO tasks." (defalias 'org-tags-sparse-tree 'org-match-sparse-tree) -(defvar org-cached-props nil) -(defun org-cached-entry-get (pom property) - (if (or (eq t org-use-property-inheritance) - (and (stringp org-use-property-inheritance) - (let ((case-fold-search t)) - (string-match-p org-use-property-inheritance property))) - (and (listp org-use-property-inheritance) - (member-ignore-case property org-use-property-inheritance))) - ;; Caching is not possible, check it directly. - (org-entry-get pom property 'inherit) - ;; Get all properties, so we can do complicated checks easily. - (cdr (assoc-string property - (or org-cached-props - (setq org-cached-props (org-entry-properties pom))) - t)))) - (defun org-global-tags-completion-table (&optional files) "Return the list of all tags in all agenda buffer/files. Optional FILES argument is a list of files which can be used @@ -11670,7 +11654,7 @@ See also `org-scan-tags'." ("CATEGORY" '(org-get-category (point))) ("TODO" 'todo) - (p `(org-cached-entry-get nil ,p)))) + (p `(org-entry-get (point) ,p 'selective)))) ;; Determine operand (aka. property ;; value). (pv (match-string 8 term)) @@ -11707,7 +11691,7 @@ See also `org-scan-tags'." (setq term rest))) (push `(and ,@tagsmatcher) orlist) (setq tagsmatcher nil)) - (setq tagsmatcher `(progn (setq org-cached-props nil) (or ,@orlist))))) + (setq tagsmatcher `(or ,@orlist)))) ;; Make the TODO matcher. (when (org-string-nw-p todomatch) -- 2.41.0 --=-=-=--