This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 4/*] Improve strcpy_chk/stpcpy_chk


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]