Improving name-truncation detection

Wayne Davison wayned at
Tue Jan 20 03:17:20 GMT 2004

On Mon, Jan 19, 2004 at 06:46:48PM -0800, jw schultz wrote:
> If you're going to do the strlen(src) and whatnot you might as well
> just snag the strlcpy source and tweak it so you only have to scan the
> data once.

I used rsync's version of strlcpy() from the lib/compat.c file as a
basis for the stringjoin() function.  I just tried the BSD version, and
it's 2.33 times slower on my Linux box (the strlen() and memcpy()
functions must be using the string-oriented processor functions on my
PIII, while the BSD version's do-it-yourself loops must not be).

> If you are going to plug in this low level function, why not do a
> version that does path joining so users don't have to provide the "/".

Just because I thought this was more generic, and there are several
sections of code that join strings without including a "/".  However,
the joining of two strings with a '/' in between is certainly a common
thing to want to do, so it might be worth a dedicated function just for
that idiom.

> Do we really have such a variety of callers that need the overhead of
> varargs?

In my timings it wasn't much of a hit -- in 900,000 iterations it caused
an extra ~.03 user-seconds of a total runtime of ~1.30 user-seconds.

FYI, the rsync code currently has string-joins that range from 2 - 4


More information about the rsync mailing list