Performance of method calls

Dave Dave_member at pathlink.com
Thu Nov 30 21:40:46 PST 2006


Daniel Keep wrote:
> Daniel Keep wrote:
>> Walter Bright wrote:
>>
>>> Daniel Keep wrote:
>>>
>>>> I hooked up a test app which used a loop with 100,000 iterations for 
>>>> each call type, and ran that program 100 times, and averaged the 
>>>> outputs.
>>>
>>>
>>>
>>> What flags did you use to compile it?
>>
>>
>> I didn't use any flags; I was worried about the compiler being "smart" 
>> and inlining the functions calls which would... well, eliminate them 
>> entirely :P
>>
>> If there are any flags you can recommend that would give more 
>> realistic results, I'd love to know.
>>
>>     -- Daniel
>>
> 
> I just recompiled and re-ran with some different flags.  The results 
> are... interesting.
> 
> (Numbers are #1/#2 and #3/#2)
> 
> -O: 1.39892 and 3.61384
> -O -release: 1.00703 and 1.0163
> -O -inline: 1.89054 and 13.4001
> -O -release -inline: 1.8257 and 1.00007
> 
> Now I've got *no* idea what to think :P
> 
>     -- Daniel

I think there's some kind of stack alignment issue going on or something... If you comment out the 
timing code, change the 'scope y' to 'auto y' and run each one at a time [with -O -release -inline] 
you get very close to the same results for each (as expected).



More information about the Digitalmars-d mailing list