| Aslan Kral 2005-03-12, 3:57 pm |
|
"Aslan Kral" <aslanski2002@yahoo.com>, haber iletisinde şunları
yazdı:39fr2iF5uq3mvU1@individual.net...
>
Oops! I failed to read the -O2 part. It makes sense now. And your code
doesn't use any lookup table that is why it is slower than Willem's. Anyway
the version with lookup table is quite close to "bsr" version. So yours also
can get faster with the addition of lookup table. It would be interesting to
see how much Ada can get close to "bsr" version below! (By adding a lookup
table, I mean.)
__inline unsigned FindHighestBit(unsigned n)
{
__asm
{
bsr eax, n
}
}
..
> OK. I adjusted the code to run in your loop.
>
> Your score is a bit strange to me?! It may be the compiler that makes the
> difference.
> I timed your code in my P4 1.4GHz NT4.0 SP6 (MSVC6) and my result is ~2100
> ms for your code while the best version suggested by Williem finishes in
> ~650 ms (which is slightly better than 1-opcode "bsr" inline assembly
> version). I guess it is because you use a 5-bit lookup table.
Unfortunately
> I couldn't test the Ada version.
>
> And I tried to run the loops twice in a row and they seem linear except
for
> the assembly version which seems to get slightly better.
> Yours: 4200 ms
> Williem's: 1300 ms
> "bsr": 1280 ms
>
>
>
>
>
>
|