Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Implementation of the abs() function [o.t.]

Author: Jens Kahlenberg

Date: 05:11:07 07/07/03

Go up one level in this thread


On July 07, 2003 at 06:09:20, Gerd Isenberg wrote:

>On July 05, 2003 at 20:32:05, Dieter Buerssner wrote:
>
>>Should be 80000000h
>>
>>I get a very strange table, when I let MSVC inline - omid is *much* faster than
>>nothing! And this reproducable. And totally unexplainable by looking at the
>>generated assembly. Very strange.
>>
>>MSVC, Russel's code, -Ox2 -Ob2 -G6 -Gr -GF
>>
>>       nothing 3951541892 13.309
>>         abs() 1713113360 14.400
>>  simple_abs() 1713113360 17.936
>>    omid_abs() 1713113360 7.932   !!! Yes, reprocucable
>>     sbb_abs() 1713113360 17.144
>>     cdq_abs() 1713113360 17.555
>>    fish_abs() 1713113360 20.900
>>     sar_abs() 1713113360 16.464
>>   cmovl_abs() 1713113360 17.365
>>   cmovs_abs() 1713113360 17.345
>>
>
>i tried Russells test on P4 2.4GHz:
>MSVC, corrected Russel's code, inlined
>Speep optimization,
>/GX /O2 /Oy-
>
>       nothing 3951541892 13.671
>         abs() 1713113360 13.438!
>    omid_abs() 1713113360 14.641
>     sbb_abs() 1713113360 16.640
>     cdq_abs() 1713113360 17.954
>     sar_abs() 1713113360 18.781
>   cmovl_abs() 1713113360 19.282
>   cmovs_abs() 1713113360 19.140
>  simple_abs() 1713113360 19.781
>    fish_abs() 1713113360 22.515
>
>custom optimization:
>/G6 /Gr /ML /W3 /Ox /Ot /Oa /Ow /Og /Ob2
>
>       nothing 3951541892 13.390
>         abs() 1713113360 13.141!
>    omid_abs() 1713113360 13.672
>   cmovs_abs() 1713113360 16.781
>   cmovl_abs() 1713113360 16.782
>     sbb_abs() 1713113360 17.969
>     cdq_abs() 1713113360 17.625
>     sar_abs() 1713113360 16.984
>  simple_abs() 1713113360 19.562
>    fish_abs() 1713113360 21.750
>
>Gerd

My personal conclusions on this very exciting (and surely not o.t.) thread are:

1. abs is faster than nothing (else) :-)
2. I'll keep on using libraries and don't work around them
3. No rule without exception ->
_properties_ of MSVC rand (i'm not refering to these strange performance issues)
are worth a workaround. Next time i need a good PRNG i'll think about
implementing a Mersenne Twister from scratch and trying to optimize its speed
with abs or omid_abs nearby the my_rand() calls ;-)

Best regards,
Jens



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.