Am Mon, 2002-12-02 um 20.15 schrieb David Laight:
Actually I don't have glibc - I'm running netbsd not linux. Netbsd might benefit from faster strxxx routines.
Can't you use an optimized glibc on NetBSD?
OTOH the times are very dependant on the cpu model! My slotA athlon 700 executes my str_add() faster the way I coded it - I tried the other order and it sucked.
With gcc 3.2? That compiler optimizes the jmp away in an if statement, apparently assuming that the "if" clause is executed much more often. The "else" clause, OTOH, jmp's to the end of the subroutine and jumps back afterwards. Thus if the compiler guesses wrongly, the CPU'll have to do two more jmp's per loop, with possible instruction cache miss. Hard for me to believe that'll be a speed improvement on any CPU. If the compiler guesses right, 1 jmp will be saved per loop.
Of course you can use the same tricks as glibc does to speed up your own variant of the copy routine.
I am not talking what you or I could or couldn't do. I am just saying Wine should rely on glibc for these things, and not try to outwit those who're doing these things all the time.
Martin