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 1D512431FAF for ; Tue, 21 Feb 2012 03:23:16 -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 oth3pO9UUnKp for ; Tue, 21 Feb 2012 03:23:12 -0800 (PST) Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) by olra.theworths.org (Postfix) with ESMTP id 29FB8431FAE for ; Tue, 21 Feb 2012 03:23:12 -0800 (PST) Received: by guru.guru-group.fi (Postfix, from userid 501) id 4CFCA68055; Tue, 21 Feb 2012 13:23:11 +0200 (EET) From: Tomi Ollila To: Justus Winter <4winter@informatik.uni-hamburg.de>, Daniel Schoepe , Philippe LeCavalier , notmuch@notmuchmail.org Subject: Re: nomuch_addresses.py In-Reply-To: <20120221091509.8534.59492@thinkbox.jade-hamburg.de> References: <87r4xur3rv.fsf@plc.plecavalier.com> <87fweamenf.fsf@schoepe.localhost> <20120221091509.8534.59492@thinkbox.jade-hamburg.de> User-Agent: Notmuch/0.11.1+198~g922c4d2 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-unknown-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: Tue, 21 Feb 2012 11:23:16 -0000 On Tue, 21 Feb 2012 09:15:09 -0000, Justus Winter <4winter@informatik.uni-hamburg.de> wrote: > Quoting Daniel Schoepe (2012-02-17 02:28:52) [emphasis mine]: > >Just for completeness: I'm using the nice nottoomuch-addresses.pl script > >[1] by Tomi Ollila *which doesn't require any bindings* and is incredibly > >fast (after generating an initial address database). > > I don't get it. The perl script isn't using any library bindings, > mainly because there are no libnotmuch bindings for perl. *But* it > does call the notmuch binary which is worse: > > * incredibly high overhead (fork&exec) compared to a simple function > call (plus maybe some kind of ffi) > * manual and error prone serialization of ''function arguments'' > * manual and error prone deserialization of ''return values'' > * very limited error reporting and handling capabilities > * any kind of resource (think handle to a xapian database) is lost if > the process exists resulting in further overhead if the binary is > called multiple times Shortly answering nottoomuch-addresses.sh's (version 2.0) point of view. Searching from "database" is done using fgrep. that means 2 forks, 2 execs from command line (it used to be one fork but now we handle fgrep return value) (fork, exec /bin/sh, fork, exec fgrep). Anyway, usually matches are printed out by fgrep before ENTER key has risen (or TAB when run from emacs). The "database" is created by perl program ("embedded" in nottoomuch-addresses.sh), it executes notmuch once to get all email filenames (since beginning of time or since last update) -- the perl code then parses email addresses out of those files, cleans those up, removes duplicates and writes those to the "database" files (all and one with ignored removed)... So that newest are in top of the file, returned first in fgrep(1) execution. > I do get the feeling that it is perceived as desirable not to require > any kind of notmuch bindings (David once said something similar about > nmbug). > > If that's the case I'd love to hear why and if there's anything we can > do about it. It would be nice if notmuch(1) itself had command to be used for address completion. I wonder how feasible it is to get a good implementation there... > > Justus Tomi