Date: Tue, 19 Dec 2000 08:16:16 +1100 From: Peter Jeremy <peter.jeremy@alcatel.com.au> To: Warner Losh <imp@village.org> Cc: Assar Westerlund <assar@FreeBSD.ORG>, Dag-Erling Smorgrav <des@ofug.org>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/libkern strlcat.c strlcpy.c src/sys/sys libkern.h src/sys/conf files Message-ID: <20001219081616.D54775@gsmx07.alcatel.com.au> In-Reply-To: <200012181724.KAA91757@harmony.village.org>; from imp@village.org on Mon, Dec 18, 2000 at 10:24:28AM -0700 References: <5l4s01ka92.fsf@assaris.sics.se> <200012180408.eBI48wg99879@freefall.freebsd.org> <xzpu282ypvp.fsf@flood.ping.uio.no> <5l66khluty.fsf@assaris.sics.se> <xzpitohzu34.fsf@flood.ping.uio.no> <xzpae9tztba.fsf@flood.ping.uio.no> <5lsnnlkcf7.fsf@assaris.sics.se> <xzp66khzsdn.fsf@flood.ping.uio.no> <5l4s01ka92.fsf@assaris.sics.se> <200012181724.KAA91757@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-Dec-18 10:24:28 -0700, Warner Losh <imp@village.org> wrote: > The one in libc is known to >be good and not have any bugs, so why reinvent it for the kernel? I'd go further and say that unless there is a compelling reason otherwise, libkern should always use the code in libc (or vice versa). It's a pity that our source structure doesn't allow us to use the same file (you can checkout and build the kernel without installing the userland sources). >The paper that was presented at Usenix shows that these routines were >nearly as fast as the hand tweaked assembler that they replaced on >intel. Not sure about other architectures. The Alpha (particularly older implementations) are very poor at byte-handling. I'm not sure about the IA64, but I suspect it's the same. Keep in mind that gcc doesn't generate brilliant code on the Alpha (and probably the IA64) - which won't help. My experience is that unrolling the loop to the point where you are copying long's is a win on all architectures. Have a look at /sys/libkern/bcmp.c for sample code. Adapting it for bcopy/memcpy is trivial. Adapting it for str[ln]{cpy,cmp,cat} is non-trivial on the i386 but not too difficult on the Alpha (using CMPBGE). I'm not sure about the IA64. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001219081616.D54775>