From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OJ2UJzi56mCxHwAAgWs5BA (envelope-from ) for ; Sun, 11 Jul 2021 11:26:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id COY5Izi56mBPbgAAbx9fmQ (envelope-from ) for ; Sun, 11 Jul 2021 09:26:16 +0000 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 302B526876 for ; Sun, 11 Jul 2021 11:26:16 +0200 (CEST) Received: from localhost ([::1]:32982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2Vj4-0000cj-ES for larch@yhetil.org; Sun, 11 Jul 2021 05:26:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2ViW-0000cb-Hz for emacs-orgmode@gnu.org; Sun, 11 Jul 2021 05:25:40 -0400 Received: from ciao.gmane.io ([116.202.254.214]:54162) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2ViV-00083I-4Y for emacs-orgmode@gnu.org; Sun, 11 Jul 2021 05:25:40 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1m2ViT-0000is-Bu for emacs-orgmode@gnu.org; Sun, 11 Jul 2021 11:25:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Re: [BUG] org-goto slows down org-set-property Date: Sun, 11 Jul 2021 16:25:30 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 26 X-Spam_score: 2.6 X-Spam_bar: ++ X-Spam_report: (2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, NICE_REPLY_A=-0.001, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625995576; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9zJuhOujo6zGh16aJIK0k56zLuZzgdU7Ryn2FWmjjH0=; b=IldvH9f4JmA3Pa9M+Ja7IrAhZckstbGPrBRablVzVfkNn+sqww4wlJNpl2Nt4J+9/glmLD ZbyKT5S3eOLfJoPJ/8wWaUt6ytT4Jx22VJSreyq83BKNvAik8txP2q8afxU9LUpkCRbASP qhUDQA61YiNc9aDP3/rHuNo1FKndqjsmpSTlIuBrEVLSA8YtOYCl3zLjBfKjc1IvScrPs6 QF4mXntwBAoHxWA2K5opuVmy5INaxPayURTI/vkP748Q70DVR14vGy36huQ03AwOag3MEH 1Hh43oehYgJGzwnirf8T7kv8Rj/5G/3S+55hkI9BF1GsxPEicgQB5aV9NclhCw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625995576; a=rsa-sha256; cv=none; b=UpaY/9Yx/Zrds1DG8DTpfkHmpUeyBLaoWSQO2tZfAKZX/3pNSGtKbzmUbIx2tJohWYilLc DMYtrHu8uaHqmyu/Cnr5KZ33Jcj5ZMXVmgLTk2+hjMWNGQ4qov3QD3hROmeNkn3I3vd2pN T+aI9rGBPQysvp/xnplAMF8oQItpJyx/7gkSIGebpJhdoRQChNdbyh0m7oIJ4StLrQJrFU CQAt70pF7puyT8akyuPYoI8sG3mB9QdnDVBfCO+nW3e7OalSikYR66mlVbjJksELxIQypG W8hgtUFF2GdbO9Q1sXs+ie8ZpLJPHVFi1VudeAtKaR8ZjF3HGd0uCNElaaCnIg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.81 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@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 302B526876 X-Spam-Score: -1.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: vYLNxCFoHfGu On 10/07/2021 22:47, Maxim Nikulin wrote: > It is rather annoying that C-c C-x p `org-set-property' may be quite > slow if a file is large enough. (I do not consider it huge however.) > There is noticeable delay before the prompt for property name appears in > minibuffer. Accidentally I have noticed that sometimes it is fast. > > Problem appears after first jump using C-u C-c C-j `org-goto'. Actually > a jump is not required, it is enough to get jump (refile) targets. It is strange. Merely 3500 markers created by org-refile-cache in 2.2Mb file ruin performance of regexps in that buffer. I would expect either no influence of markers at all since search is a read-only operation or some negligible penalty proportional to fraction of markers in relation to total amount of characters. Look at the numbers for nm-test that is just some regexp searches from `org-buffer-property-keys'. Performance is restored after clearing of the cache. #+begin_src elisp (defun nm-tst () (org-with-wide-buffer (goto-char (point-min)) (while (re-search-forward org-property-start-re nil t) (org-get-property-block) (outline-next-heading)) nil)) (org-refile-cache-clear) (let ((org-refile-targets '((nil :maxlevel . 6))) (org-refile-use-outline-path 'file) (org-refile-use-cache t) (iters 10)) (cons (list (org-version)) (mapcar (lambda (f) (append (list f) (benchmark-run iters (funcall f)))) (list #'nm-tst ; #'org-buffer-property-keys #'org-refile-get-targets #'nm-tst ; #'org-buffer-property-keys #'org-refile-cache-clear #'nm-tst)))) #+end_src #+RESULTS: | 9.4.6 | | | | | nm-tst | 0.044981942 | 0 | 0.0 | | org-refile-get-targets | 1.748572638 | 8 | 0.3876601379999993 | | nm-tst | 0.393022201 | 0 | 0.0 | | org-refile-cache-clear | 0.001787078 | 0 | 0.0 | | nm-tst | 0.035731803 | 0 | 0.0 | It seems, it is better to drop org-refile-cache completely. It has some design problems making it rather fragile. At the same time a patch can be applied that improves performance of `org-refile-get-targets' by a factor of at least 2 for (org-refile-use-outline-path 'file). Emacs-26.3