News for hackers. Stuff that matters.
Re:A queue of page faults (2014) by david-given on Wednesday June 15, 2016 @12:59AM (#11907233)
ia32 architectures do actually have an instruction which lets you do cheap memcpys and memsets --- REP (and friends). All it does it to repeat the next instruction rapidly, so if the next instruction is a set-and-increment-pointer than you get a memset. etc. (Don't know about ia64.)

Trouble is, it's still just a simple loop, and it's not that much faster than doing it the long way... and on some architectures it's actually slower. It all depends on how optimised the microcode it decodes into is. After all, it still has to set the address bus and issue a write for every location in the RAM. There are no shortcuts there.

Some architectures will let you do memcpys and memsets via the DMA engine, which can give a small performance boost, but these are usually embedded architectures. (I've used one on the MSP430.)

Re:A queue of page faults (2014) by MichaelGG on Wednesday June 15, 2016 @02:10PM (#11910914)
Is it though? The memcpy implementations I remember reading about do all sorts of exotic things depending on the size, which processor, etc.

As you mention, sometimes it's still slower and depends on microcode. A dedicated memcpy instruction shouldn't have that issue right?