emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: Re: How to make agenda generation faster
Date: Wed, 17 Oct 2018 14:12:08 -0500	[thread overview]
Message-ID: <87h8hkqtfb.fsf@alphapapa.net> (raw)
In-Reply-To: 87pnw8engh.fsf@nicolasgoaziou.fr

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> It can, but AFAIK, it doesn't yet. It also means un-optimized lexical
> binding may be slightly slower than dynamic scoping for the time
> being.

Well, I can't vouch for it myself, because I haven't studied the code.
But here's one of the resources that suggests it is faster to use
lexical binding:

https://emacs.stackexchange.com/questions/2129/why-is-let-faster-with-lexical-scope

> That's not exactly what I'm suggesting. I suggest to move the work in
> Org tree, e.g., as an org-agenda-ng.el library, and, from there,
> implement back most of the features of the current agenda.
>
> Org cannot really benefit from libraries living outside Emacs, as we
> recently learnt with htmlize issue.

Org is welcome to take any of the org-ql or org-ql-agenda code you think
would be useful.

However, before it could be suitable as a possible replacement, it will
likely require more optimization.  Some queries, especially more complex
ones, are slower than the equivalent searches and agendas in the current
Org Agenda code.  This is because of the way the queries run predicates
on each heading.  Despite the current Org Agenda code's complexity, it
is well optimized and hard to beat.

I have a proof-of-concept branch that begins to implement a relatively
simple optimization that converts one suitable predicate in a query to a
buffer-global regexp search.  It significantly improves speed in some
cases, but a query with several predicates still has to run all but one
of them as predicates.

Another possible optimization would be to convert as many predicates in
a query to buffer regexp searches as possible, collecting a list of
heading positions in the buffer, and then do a final pass with the
appropriate union/intersection/difference operations on the lists.  Then
the list of positions could be used to gather the heading data.  I use a
similar technique in helm-org-rifle, and it seems to work quickly.  It
would require some work on a sort of "query compiler" to do the
transformation and optimization.  I don't have much experience with that
kind of programming; maybe someone else would be interested in helping
with that.

So before taking any of the code into Org itself, you might want to
consider these issues and decide whether it could be a suitable
approach.  Let me know what you'd like to do and how I can help.

Thanks,
Adam

  reply	other threads:[~2018-10-17 19:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-07  4:53 How to make agenda generation faster Marcin Borkowski
2018-10-08  7:20 ` Michael Welle
2018-10-10 20:03   ` Marcin Borkowski
2018-10-10 21:01     ` Samuel Wales
2018-10-11  6:48     ` Michael Welle
2018-10-11  8:48       ` Marcin Borkowski
2018-10-11 19:59         ` Samuel Wales
2018-10-14  8:51           ` Marcin Borkowski
2018-10-09  6:37 ` Adam Porter
2018-10-09 16:11   ` Nicolas Goaziou
2018-10-10 20:01     ` Marcin Borkowski
2018-10-16 20:35     ` Adam Porter
2018-10-17  7:04       ` Ihor Radchenko
2018-10-17 13:01       ` Nicolas Goaziou
2018-10-17 19:12         ` Adam Porter [this message]
2018-10-18 22:48           ` Nicolas Goaziou
2018-10-19  0:04             ` stardiviner
2018-10-20  2:12             ` Adam Porter
2018-10-20  8:12               ` Nicolas Goaziou
2018-10-10 19:59   ` Marcin Borkowski
2018-10-09 11:47 ` Julius Dittmar
2018-10-10 20:03   ` Marcin Borkowski
2018-10-11  6:40     ` Michael Welle
2018-10-14  7:42       ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h8hkqtfb.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).