"Strong, David" <[EMAIL PROTECTED]> writes: > The specification for strncpy () indicates that when the length of the > source string (4 bytes) is less than the length of the number of bytes > to copy (2500 bytes), the remainder of the destination string will be > padded with NULL bytes (2496). Based on the GLIBC source code, strncpy > () is written to pad the destination string a byte at a time and this is > where all the time was taken, according to OProfile.
Hm. In the PS_USE_CLOBBER_ARGV case, this is pretty silly considering we're going to MemSet the rest of the space anyway. We should probably replace the StrNCpy with something that doesn't uselessly fill the rest of the buffer, perhaps something like memcpy(dest, src, Min(strlen(dest) + 1, avail space)); I believe that most of our uses of StrNCpy actually do not expect the pad-out behavior, so maybe there are other uses for something along this line ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend