bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] Locate: Read each database only once.


From: James Youngman
Subject: Re: [Patch] Locate: Read each database only once.
Date: Mon, 30 May 2005 09:47:34 +0100
User-agent: Mutt/1.3.28i

On Mon, May 30, 2005 at 04:31:52AM +0200, Buzz wrote:

> * I really tried to get this patch as small as possible.
> * The case-folding /can/ be done less often.

Yes.  The old code used to do the case-folding on only the new
characters read out of the database (that is, each filename character
read from the database would be case-folded at most once).  However,
when I refactored the code to use the Visitor pattern, I sacrificed
that optimisation.

If you can actually measure the performance impact of the current
slightly stupid implementation of visit_substring_match_casefold(),
I'll certainly consider applying an optimisation patch.

> * These changes prepare a path towards a ``--and'' (``-a'') option.

Are you envisaging this option as a single-use option (indicating that
all patterns must match) or as a conjunction as used in "find"?  For
example are you suggesting...

   locate foo -a bar -o baz

I suppose you can already achieve something similar with
   
   ( locate 'foo.*bar' 'bar.*foo' ; locate baz  ) | sort -u

What does the rest of the list think about "-a"?

> * It is possible to allow reading a db from stdin.
> * Much of the ``main'' loop can be moved into ``visitor''s.

If you're talking about refactoring locate(), then yes, it is a bit
too long.  I'm not sure the current "Visitor" pattern is appropriate
for this though.

> (If/when this one gets applied, I intend to submit follow-up patches.)

Thanks,
James.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]