Re: Faster strlen

Andreas Schwab (schwab@suse.de)
27 Jul 1999 15:55:18 +0200


"Alexander Maryanchick" <Sasha@GDev.msk.ru> writes:

|> 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

Which is not much different from the code in glibc.

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

This is common knowlege already for at least 8 years.

-- 
Andreas Schwab                                  "And now for something
schwab@suse.de                                   completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

- 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/