Messages in this thread | | | Date | Fri, 24 Apr 1998 21:55:34 +1200 | From | Chris Wedgwood <> | Subject | Re: faster strcpy() |
| |
On Fri, Apr 24, 1998 at 02:20:13AM -0500, umforema@cc.UManitoba.CA wrote: > I'm not sure if this is a libc thing or a kernel thing, but I noticed > that strcpy is in the kernel include files, so here goes... > I changed the definition of strcpy in /usr/include/string.h to > > #define strcpy(a,b) (char *)memcpy(a,b,strlen(b)) > > It slightly more than doubles the speed of strcpy on my pentium machine.
Its a userland thing. The kernel has its own string functions.
As to why the above is faster in userland, that seems really odd. I would assume the libc string copy to be something like:
char *strcpy(char *a,char*b) { char c = b; while(*a++ = *b++); return c; }
Which I can't see how it could be slower than what you are using...
-Chris
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |