[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: substantial 'glob' speedup ...
From: |
Paul Smith |
Subject: |
Re: substantial 'glob' speedup ... |
Date: |
Thu, 07 Apr 2011 08:53:03 -0400 |
On Wed, 2011-04-06 at 12:35 +0100, Michael Meeks wrote:
> These ~all come from calling 'glob'; I append a patch that tries to
> call glob only if needed - it could be done more prettily:
That's interesting. I wonder why the glob expansion is so inefficient;
I would expect it to do the same kinds of checks that you're doing (that
is, basically be a string-walk unless a glob character is found).
> +need_to_glob (const char *name)
> +{
> + int i;
> + for (i = 0; name[i] != '\0'; i++) {
> + if (name[i] == '?' || name[i] == '*' || name[i] == '[') {
> + return 1;
> + }
> + }
> + return 0;
> +}
Why not just use strpbrk()?
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist