Faster strlen

Alexander Maryanchick (Sasha@GDev.msk.ru)
Tue, 27 Jul 1999 17:40:26 +0400


Have you seen M$' CRT?
It sometimes worth to see.
Here is a critical piece of their 'strlen' code:

mov eax,dword ptr [ecx] ; read 4 bytes
mov edx,7efefeffh
add edx,eax
xor eax,-1
xor eax,edx
add ecx,4
test eax,81010100h
je short main_loop
; found zero byte in the loop

On Pentiums this sadistic code is 4 times faster that our :-(.
Really, Gates has his von Braun.

So, some parts of Linux kernel may be optimized...

Best regards.

Alexander.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/