On Mon, 19 Mar 2007 11:17:53 +0000
Nicholas Clark <[EMAIL PROTECTED]> wrote:

> On Sun, Mar 18, 2007 at 08:33:25PM -0700, Joshua Juran wrote:
> 
[snip]
> 
> cnv = path->strstart;
> while ( (cnv = strchr( cnv, '/' )) )
> {
>       *cnv++ = '\\';
> }
> 

[snip]
 
> Whether its faster than the loop without strchr probably depends on
> whether the compiler inlines strchr(), whether the optimised version
> is efficient on non-word aligned strings, and whether the optimised
> version doesn't have a higher start cost. Either is better* than the
> current, and I don't have a Win32 platform to test on, so can't test
> a change.

all that optimization hair is another reason to punt it to strchr().
I do like your use of postfix increment here, elegant.

> Nicholas Clark
> 
> * Yes, even in a non-speed critical area, because having poor
> algorithms around will tempt people to base other code on them.

that basing argument is dead on. when I was bread-crumb dumping the
path searches it was generating ~4-5 paths per hit. With a large
environment variable set, vendor paths, extension guessing etc, this
could go alot higher.

Also one of the largest problems I have had with java is the hideous startup
time. probably why you see alot of heavy apps, and don't see as many quickie 
shebangs with java.

It all adds up. Perl scores extremely high on start speed. parrot will need
that crown as well to comfortably replace perl5.

I can think of one other reason in a similar spirit, maybe even the
most important one. This being free-sofware and not some $work$
project, complete with a pointy-hair holding a schedule like a gun, we
have the opportunity to take joy in polishing code until it shines.

as far as strchr() vs. pointer it's peanuts in comparison to the
algorithmic improvement of the function.

my preference is O(n) !

I have this on my TODO list now, but if someone beats me too it I will be
very happy. I am focused on [patch] 5 now, rt # 41908 which will probably
keep me quite busy.

$work is going to dominate my time as well until the end of the month at
least.

Cheers,
Mike Mattie ([EMAIL PROTECTED])

Attachment: signature.asc
Description: PGP signature

Reply via email to