Re: Ideas for reducing memory copying and zeroing times (fwd)

Linus Torvalds (torvalds@cs.helsinki.fi)
Fri, 19 Apr 1996 09:14:11 +0300 (EET DST)


On Fri, 19 Apr 1996, Michael Riepe wrote:
>
> I guess the fastest (and shortest) way to do that on an 80x86 is:
>
> xorl %eax,%eax
> leal 4096(page_start),%esp
> <repeat 1024 times>
> pushl %eax
> <end repeat>

No, the fastest, and shortest way to do it is

.. dest in %edi ..
movl $1024,%ecx
xorl %eax,%eax
rep; stosl

Which is in fact exactly how linux does it..

Of course, if you have an old x86 chip, that's your problem and you may
not get optimal performance, but who expected anything else from old
hardware?

(Hint: the above _really_ flies on a PPro. Intel optimized it to do
cache-line accesses, it seems. They did the right thing)

Linus