From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [PATCH] tags search: faster tags matcher by trusting scanner tags Date: Thu, 15 Mar 2012 23:13:03 -0400 Message-ID: <3953.1331867583@alphaville> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8NbI-0003sh-SF for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 23:13:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8NbH-0000zy-4r for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 23:13:08 -0400 Received: from g1t0026.austin.hp.com ([15.216.28.33]:15171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8NbG-0000zu-Tr for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 23:13:07 -0400 In-Reply-To: Message from Ilya Shlyakhter of "Thu, 15 Mar 2012 19:16:06 EDT." 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: Ilya Shlyakhter Cc: nicholas.dokos@hp.com, emacs-orgmode Ilya Shlyakhter wrote: > The attached patch speeds up tags matching ( 50s --> 5s for my most > common search ), by turning on org-trust-scanner-tags within the > matcher. > > (When it's off, getting a non-inherited property's value causes a call > to org-entry-properties to fetch all properties into a cache, > including ALLTAGS; fetching ALLTAGS involves calling > (org-get-tags-at), which is slow when org-trust-scanner-tags is off.) > > Can this cause problems / was this off for a reason? > I haven't looked at your patch carefully enough to know if it will or will not cause problems, but check the doc for org-map-entries: it has some guidelines about where the technique can be used and where it cannot: ,---- | If your function needs to retrieve the tags including inherited tags | at the *current* entry, you can use the value of the variable | `org-scanner-tags' which will be much faster than getting the value | with `org-get-tags-at'. If your function gets properties with | `org-entry-properties' at the *current* entry, bind `org-trust-scanner-tags' | to t around the call to `org-entry-properties' to get the same speedup. | Note that if your function moves around to retrieve tags and properties at | a *different* entry, you cannot use these techniques. `---- There are warnings that this variable is for internal dynamical scoping only, so I suspect you should not mess with the default. If your search can make the needed guarantees, then you can just wrap it in a let to get the speedup. Otherwise, it probably should be left alone. Nick