[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Asynchronous org-agenda-redo
From: |
Adam Porter |
Subject: |
Re: Asynchronous org-agenda-redo |
Date: |
Fri, 13 Dec 2019 22:59:00 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Ihor Radchenko <address@hidden> writes:
>>> Asynchronous code is not faster; it's generally slower because of
>>> yielding and synchronization.
>
>> Anyway, I will try to throw yields into agenda code just to check how
>> bad the performance can degrade.
>
> With the following code, org-agenda-redo runs for 21 second on my
> system, while without threads it is 16 seconds. However, emacs remains
> responsive during rebuilding agenda!
>
> (define-advice org-agenda-redo (:around (oldfun &optional all) make-async)
> (make-thread (lambda () (funcall oldfun all)) "org-agenda-redo"))
> (define-advice org-agenda-skip-eval (:around (oldfun form) make-async)
> (thread-join (make-thread (lambda () (funcall oldfun form))
> "org-agenda-skip-eval")))
That's a very elegant way to add the threading! The performance penalty
is noticeable, but the tradeoff could be worth it in some cases, like a
background agenda refresh on a timer, or after a "remote" edit. I can
imagine an org-agenda-refresh-async command that would add that advice
and remove them in an unwind-protect.
> The problem, of course, is that touching agenda buffer and org buffers
> may be risky while org-agenda-redo is running.
> Wondering if it is possible to block user commands during that time.
The first thing that comes to mind is to set buffer-read-only on each
buffer before it is scanned, and unset it when done with a buffer. That
might not be doable with advice.
- Asynchronous org-agenda-redo, Ihor Radchenko, 2019/12/12
- Re: Asynchronous org-agenda-redo, Adam Porter, 2019/12/12
- Re: Asynchronous org-agenda-redo, Ihor Radchenko, 2019/12/12
- Re: Asynchronous org-agenda-redo, Adam Porter, 2019/12/13
- Re: Asynchronous org-agenda-redo, Ihor Radchenko, 2019/12/13
- Re: Asynchronous org-agenda-redo, Ihor Radchenko, 2019/12/13
- Re: Asynchronous org-agenda-redo,
Adam Porter <=
- Re: Asynchronous org-agenda-redo, Ihor Radchenko, 2019/12/22
- Re: Asynchronous org-agenda-redo, Adam Porter, 2019/12/23
- Re: Asynchronous org-agenda-redo, Adam Porter, 2019/12/13
- Re: Asynchronous org-agenda-redo, Ihor Radchenko, 2019/12/16
- Re: Asynchronous org-agenda-redo, Adam Porter, 2019/12/16
Re: Asynchronous org-agenda-redo, Diego Zamboni, 2019/12/12