Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DDD3B429E21 for ; Wed, 16 Nov 2011 09:41:28 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tKR5aF1avf3c for ; Wed, 16 Nov 2011 09:41:28 -0800 (PST) Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id F1EF4431FD0 for ; Wed, 16 Nov 2011 09:41:27 -0800 (PST) Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31]) by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id pAGHfNFh007787; Wed, 16 Nov 2011 19:41:23 +0200 From: Tomi Ollila To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH v2] tag: Automatically limit to messages whose tags will actually change. In-Reply-To: <1320846275-28520-1-git-send-email-amdragon@mit.edu> References: <1320724523-23568-1-git-send-email-amdragon@mit.edu> <1320846275-28520-1-git-send-email-amdragon@mit.edu> User-Agent: Notmuch/0.9+73~ged20210 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 17:41:29 -0000 On Wed, 9 Nov 2011 08:44:35 -0500, Austin Clements wrote: > This optimizes the user's tagging query to exclude messages that won't > be affected by the tagging operation, saving computation and IO for > redundant tagging operations. > > For example, > notmuch tag +notmuch to:notmuch@notmuchmail.org > will now use the query > ( to:notmuch@notmuchmail.org ) and (not tag:"notmuch") > > In the past, we've often suggested that people do this exact > transformation by hand for slow tagging operations. This makes that > unnecessary. > --- > This version addresses Jani's comments. > > NEWS | 9 ++++++ > notmuch-tag.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 94 insertions(+), 0 deletions(-) > Reviewed code, looks good * Empty query string checked before entering _optimize_tag_query (if that matters) * All allocations checked * The logic look sound and creation of that query string is ok, too. * I trust escaping is done the way it is done (quotes around, doubling any quotes (") in string). * orig_query_string could be freed in _optimize_query_string() the data becomes garbage pointer to it lost after that call. However, _optimize_query_string() doesn't know that so it is better to leave talloc do the freeing (a bit later). Tomi