unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH v4] emacs: Call "notmuch tag" once when applying tag changes to a thread.
Date: Wed, 08 Feb 2012 20:56:48 +0400	[thread overview]
Message-ID: <87sjil8drj.fsf@gmail.com> (raw)
In-Reply-To: <1328719395-6333-1-git-send-email-dme@dme.org>

On Wed,  8 Feb 2012 16:43:15 +0000, David Edmondson <dme@dme.org> wrote:
> Optimize thread tagging by combining all the tagging operations to a
> single "notmuch tag" call.
> 
> For threads in the order of tens or a hundred inbox tagged messages,
> this gives a noticeable speedup. On two different machines, archiving
> a thread of about 50 inbox tagged messages goes down from 10+ seconds
> to about 0.5 seconds.
> 
> The bottleneck is not within emacs; the same behaviour can be observed
> in the CLI. This approach has the added benefit of being more
> reliable: any of the individual tagging operations might face a locked
> database, leading to partial results.
> 
> This introduces a limitation to the number of messages that can be
> archived at the same time (through ARG_MAX limiting the command
> line). While at least on Linux this seems more like a theoretical
> limitation than a real one, it could be avoided by archiving at most a
> few hundred messages at a time.
> 
> Based on code from Jani Nikula <jani@nikula.org>.
> ---
> 
> v4:
> - Rebased after Dmitry's tagging changes (yay!).
> 

Now, that my tagging changes are pushed, the same effect can be (and
should be) achieved by some code cleanup and function reuse.

This patch is obsoleted by [1].

Regards,
  Dmitry

[1] id:"1328719731-13402-1-git-send-email-dmitry.kurochkin@gmail.com"

>  emacs/notmuch-show.el |   18 +++++++++++-------
>  1 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index faa9f9b..9294bc8 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1599,14 +1599,18 @@ argument, hide all of the messages."
>    (backward-button 1))
>  
>  (defun notmuch-show-tag-thread-internal (tag &optional remove)
> -  "Add tag to the current set of messages.
> +  "Add TAG to the current set of messages.
>  
> -If the remove switch is given, tags will be removed instead of
> -added."
> -  (goto-char (point-min))
> -  (let ((op (if remove "-" "+")))
> -    (loop do (notmuch-show-tag-message (concat op tag))
> -	  until (not (notmuch-show-goto-message-next)))))
> +If REMOVE is non-nil, TAG will be removed rather than added."
> +  (save-excursion
> +    (goto-char (point-min))
> +    (let ((tag-op (concat (if remove "-" "+") tag))
> +	  (message-ids
> +	   (loop collect (notmuch-show-get-message-id)
> +		 until (not (notmuch-show-goto-message-next)))))
> +      (if message-ids
> +	  (notmuch-tag (mapconcat #'identity message-ids " OR ")
> +		       tag-op)))))
>  
>  (defun notmuch-show-add-tag-thread (tag)
>    "Add tag to all messages in the current thread."
> -- 
> 1.7.8.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

      reply	other threads:[~2012-02-08 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 16:31 [PATCH v2] emacs: call "notmuch tag" only once when archiving a thread Jani Nikula
2012-02-08  8:36 ` [PATCH v3] emacs: Call "notmuch tag" once when applying tag changes to " David Edmondson
2012-02-08  9:59   ` Tomi Ollila
2012-02-08 16:43 ` [PATCH v4] " David Edmondson
2012-02-08 16:56   ` Dmitry Kurochkin [this message]

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://notmuchmail.org/

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

  git send-email \
    --in-reply-to=87sjil8drj.fsf@gmail.com \
    --to=dmitry.kurochkin@gmail.com \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.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://yhetil.org/notmuch.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).