[RFC 4/*] Improve strcpy_chk/stpcpy_chk
Ondřej Bílka
neleai@seznam.cz
Wed Sep 4 01:02:00 GMT 2013
A checked strcpy/stpcpy are currently slow due to assembly implementation.
We could improve speed by using c implementation like:
char *strcpy_chk(char *dest, char *src)
{
size_t n=strlen(src);
/* Check for overlap. */
return memcpy(dest,src,n);
}
simple_stpcpy_chk normal_stpcpy __stpcpy_chk
Length 32, alignment 6/ 4: 42 0 15
Length 64, alignment 0/ 0: 124 0 9
Length 64, alignment 5/ 6: 160 0 27
Length 128, alignment 0/ 0: 226 3 24
Length 128, alignment 4/ 0: 226 6 39
Length 256, alignment 0/ 0: 453 15 57
Length 256, alignment 3/ 2: 453 12 69
Length 512, alignment 0/ 0: 897 33 142
Length 512, alignment 2/ 4: 1094 30 196
Length 1024, alignment 0/ 0: 1792 63 299
Length 1024, alignment 1/ 6: 2239 66 399
More information about the Libc-alpha
mailing list