Boost logo

Boost :

Subject: Re: [boost] proposal - Statistically robust function timing for performance decisions.
From: Matthias Troyer (troyer_at_[hidden])
Date: 2009-07-29 02:06:41


On 19 Jul 2009, at 16:00, Edward Grace wrote:

>
> On 19 Jul 2009, at 22:15, Mathias Gaunard wrote:
>
>> Edward Grace wrote:
>>
>>> I modified the example to force side-effects by making the
>>> variables in
>>> the loop global. Consequently it now doesn't get optimised away -
>>> compilers sure are clever these days.
>>
>> Rather, I think you should use volatile or something, which is
>> guaranteed by the C++ standard not be optimized out.
>
> Nice idea. I wondered if it could be applied to functions or
> function pointers. I'm not convinced it's properly supported in
> this context. Anyhow, I think a 'global variable' trick works. A
> more elegant solution is welcome!

Volatile will have more side effects and prevent optimization that we
might want the compiler to make


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk