From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] Fix massive slowdown in org-id-find Date: Mon, 23 Mar 2015 23:13:28 +0100 Message-ID: <87vbhrnz07.fsf@nicolasgoaziou.fr> References: <87bnjj2565.fsf@sophokles.streitblatt.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaAa1-000315-3Z for emacs-orgmode@gnu.org; Mon, 23 Mar 2015 18:12:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YaAZx-0008FM-Tn for emacs-orgmode@gnu.org; Mon, 23 Mar 2015 18:12:17 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:44300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaAZx-0008Ei-NX for emacs-orgmode@gnu.org; Mon, 23 Mar 2015 18:12:13 -0400 In-Reply-To: <87bnjj2565.fsf@sophokles.streitblatt.de> (Florian Beck's message of "Mon, 23 Mar 2015 14:51:14 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Florian Beck Cc: emacs-orgmode@gnu.org Hello, Florian Beck writes: > the recent changes in org-id (presumably > 8cdb2eef0f9f98f9e00a5e689decfe341fe0c6ec) lead to a massive slowdown. Would you mind elaborating a bit? Slow down doing what? In which cases? Could you profile it? > org-id-find is slow as it is, now I find it almost unusable. > > Attached patch provides a fix. Thanks. However, your patch is (partly) wrong. > - (re (org-re-property property nil (not value)))) > - (catch 'exit > - (while (re-search-forward re nil t) > - (when (if value (equal value (org-entry-get (point) property nil t)) > - (org-entry-get (point) property nil t)) > - (throw 'exit (progn (org-back-to-heading t) (point))))))))) > + (re (org-re-property property nil (not value) value))) > + (when (re-search-forward re nil t) > + (org-back-to-heading t) > + (point))))) Here, it catches false positives, e.g., lines looking like properties in example blocks. It also overlooks accumulated values. It should fail with "make test". However, the optional VALUE argument is nice (I think some profiling would still be welcome, tho). Regards, -- Nicolas Goaziou