Why is memcmp(a, b, size) so much faster than:
memcmp(a, b, size)
for(i = 0; i < nelements; i++) { if a[i] != b[i] return 0; } return 1;
I
It's usually a compiler intrinsic that is translated into fast assembly with specialized instructions for comparing blocks of memory.
intrinsic memcmp