3 ms·
Behold the OSX library version of memcpy, 177 instructions long: https://gist.github.com/tlbtlbtlb/6f6fdc5154210dc72950d8ef02ca009f https://gist.github.com/tlbt
by tlb 9y ago
Behold the OSX library version of memcpy, 177 instructions long: https://gist.github.com/tlbtlbtlb/6f6fdc5154210dc72950d8ef02ca009f https://gist.github.com/tlbtlbtlb/6f6fdc5154210dc72950d8ef02.... It unrolls to 128 byte chunks. Presumably it's enough faster than REP MOVS to justify the memory footprint.
I believe most libc implementations are similar, such as glibc: https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=string/memmove.c;hb=HEAD https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=strin...