bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH] Apply pattern-matching immediately beneath the stow director


From: Sergiu Ivanov
Subject: Re: [PATCH] Apply pattern-matching immediately beneath the stow directory.
Date: Wed, 23 Sep 2009 15:06:21 +0300
User-agent: Mutt/1.5.20 (2009-06-14)

Hello,

On Tue, Sep 22, 2009 at 03:25:39AM +0200, olafBuddenhagen@gmx.net wrote:
>
> I still don't understand why you think that the current hardcoded
> "descend into all directories, then match all subdirectories against
> foo" is more efficient than "descend into all directories matching *
> (i.e. all directories), then match all subdirectories against foo"?...

Hm, I think I can understand what exactly I failed to notice in your
questions.  Let me try an explicit description of the original
functionality to avoid ambiguity.

Consider a directory stow/ with the following structure:

stow/
  a/
    foo/
    something-else/
      foo/
    foo1/
  b/
    foo/
    anything/
      something/
        foo/

The pattern being ``foo*''.

The original implementations does the following

1. List all proper subdirectories of a/ and b/ (i.e. foo/ ,
   something-else/ , foo1/ , and foo/ , anything/ );

2. Check which of the obtained subdirectories matches the pattern and
   union it (i.e. the following directories will be merged: foo/ ,
   foo1/ , foo/).

The original implementation does not care about
stow/b/foo/anything/something/foo/ , although this directory matches
the pattern ``foo*''.

It takes the original implementation a single loop to do the pattern
matching.

In multicomponent matching with the optimization that you don't go
deeper than the number of components you have, matching ``*/foo'' will
indeed require the same number of operations.

The misunderstanding, IMHO, appeared mainly due to the fact that I
didn't universally take into account the fact that you don't need to
go deeper than the number of components in the pattern :-( Sorry :-(

Regards,
scolobb




reply via email to

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