From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: How to make agenda generation faster Date: Sat, 20 Oct 2018 10:12:41 +0200 Message-ID: <87bm7phw92.fsf@nicolasgoaziou.fr> References: <87h8hy1ho5.fsf@mbork.pl> <87o9c34ocl.fsf@alphapapa.net> <877eirdrqt.fsf@nicolasgoaziou.fr> <87ftx5fx3n.fsf@alphapapa.net> <87pnw8engh.fsf@nicolasgoaziou.fr> <87h8hkqtfb.fsf@alphapapa.net> <87r2gm6fdp.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDmNQ-0005ov-WC for emacs-orgmode@gnu.org; Sat, 20 Oct 2018 04:12:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDmNN-0006fW-R3 for emacs-orgmode@gnu.org; Sat, 20 Oct 2018 04:12:52 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:40945) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDmNL-0006XG-W3 for emacs-orgmode@gnu.org; Sat, 20 Oct 2018 04:12:48 -0400 In-Reply-To: (Adam Porter's message of "Fri, 19 Oct 2018 21:12:01 -0500") 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" To: Adam Porter Cc: emacs-orgmode@gnu.org Hello, Adam Porter writes: > Yes, because this is the fastest way to search for matching entries in a > buffer, when it's possible to use a regexp search. You would still do regexp searches, but not at the time of queries. > That would be ideal. The problem I foresee is that, when a buffer's cache > is not up-to-date, and the user runs an agenda query, the user will have = to > wait for the buffer to be parsed and cached, which is much slower than a > regexp search through the buffer. No, because filling cache is still a regexp search. > That was what I first tried with org-agenda-ng: I parsed the whole buffer > with org-element and ran predicates against the element tree. Org Element is not needed, and even shouldn't be used, to retrieve most agenda related data. There are exceptions of course, mainly plain timestamps and clocks. This is where the current agenda is hard to beat, because 1. it cheats and includes timestamps without checking context, 2. it only searches for timestamps related to the day being displayed in the agenda view. The last point makes it particularly fast for single day views. > Another idea I've had, similar to yours, would be to pre-process buffers, > adding metadata as text-properties on heading lines. However, I haven't > tested it, and I don't know what the performance would be like. And it > would still suffer from the caching problem I mentioned. It is still a way to cache stuff. The difficulty here is to keep data up-to-date with changes. Storing per-node cache could be nice, nevertheless. > I think the fundamental problems are 1) keeping the cache in sync with the > raw buffer, Yes, whole buffer caching is simpler here: drop all cached data if buffer contents differ from the cached one. That's what I did in may last attempt to speed up agenda, comparing md5sums. It works reasonably well. I also cached per agenda data type (schedules, deadlines, clocks=E2=80=A6) = but that means you know something about the query. I think querying and searching should be separated should it shouldn't be done. > and 2) the slow speed of parsing an entire buffer's metadata at > once (depending on the size of the files, of course, but mine are big > enough to be slow, and I'm sure many users have larger ones). I think this could be solved by fetching data preemptively during idle time. I would also work well with per-node caching, since you can interrupt fetching easily. Regards, --=20 Nicolas Goaziou