Re: faster strcpy()

Vojtech Pavlik (vojtech-lists@twilight.ucw.cz)
Sun, 26 Apr 1998 18:38:42 +0200


On Fri, Apr 24, 1998 at 07:33:33PM +0200, Mikael Klasson wrote:
> > > > while(*a++=*b++); perhaps?
> > >
> > > No, that's how it was before. This copies byte at time and is slow.
> > > memcpy is fast. If we could use the same technique as memcpy uses
> > > to copy strings and at the same time check the terminating 0...
> > > I don't see the answer myself, does anybody see?
> >
> > I don't know c or i386 assembler, but there are string commands. Would
> one of
> > them do it? I don't have my assembler book handy. Is there a store and
> > continue while zero?
>
> No. There's "rep movsX" (where X is b/w/d) for moving data but that one
> requires ecx to be initialized to the number of items to copy and
> doesn't care much about what it's copying. A "lodsd" and "stosd"

What about repnz? What do you think it does?

By the way, using FPU for the strcpy might be even faster.
from what I heard from Pavel Machek <pavel@ucw.cz> with a couple
really weird tricks this can be done very fast. If I remember
correctly, he was talking to the glibc people already about it.

Vojtech

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu