[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Nitpick to libsvn_subr/svn_string.c

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2004-11-14 18:04:06 CET

Branko ─îibej wrote:
> Jesper Louis Andersen wrote:
>> The patch simply works by making i an apr_size_t, increasing it
>> and making the calculation str->len - i instead. Note that str->len
>> is loop invariant and str->len - i can be common subexpression
>> eliminated. Thus the performance drop should not be measureable.
>>
> Ah, but whilst "len - i" can be CSE'd, it cant' be avoided. You can
> avoid the slowdown by continuing to use a countdown loop but shifting
> the limits, thusly:

Good, but why are we writing this function out long-hand and not just calling
standard strrchr() and subtracting the start pointer from its result (if
non-null)? We can reasonably expect strrchr() to be implemented efficiently
for the platform on which it is running, and it may do better than our generic
version.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 14 18:05:14 2004

This is an archived mail posted to the Subversion Dev mailing list.