On Thursday, 27 October 2022 at 18:41:36 UTC, Dennis wrote:
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote:
How can I prevent the compiler from removing the code I want
to measure?
With many C compilers, you can use volatile assembly blocks for
that. With LDC -O3, a regular assembly
On Friday, 28 October 2022 at 09:48:14 UTC, ab wrote:
Thanks to H.S. Teoh and Dennis for the suggestions, they both
work. I like the empty asm block a bit more because it is less
invasive, but it only works with ldc.
I used the volatileLoad/volatileStore functions to ensure that
the compiler
On Friday, 28 October 2022 at 09:48:14 UTC, ab wrote:
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote:
[...]
Thanks to H.S. Teoh and Dennis for the suggestions, they both
work. I like the empty asm block a bit more because it is less
invasive, but it only works with ldc.
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote:
Hi,
when trying to compare different implementations of the
optimized builds of a pure function using benchmark from
std.datetime.stopwatch, I get times equal to zero, I suppose
because the functions are not executed as they do not have
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote:
How can I prevent the compiler from removing the code I want to
measure?
With many C compilers, you can use volatile assembly blocks for
that. With LDC -O3, a regular assembly block also does the trick
currently:
```D
void main()
{
On Thu, Oct 27, 2022 at 06:20:10PM +, Imperatorn via Digitalmars-d-learn
wrote:
> On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote:
> > Hi,
> >
> > when trying to compare different implementations of the optimized
> > builds of a pure function using benchmark from
> >
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote:
Hi,
when trying to compare different implementations of the
optimized builds of a pure function using benchmark from
std.datetime.stopwatch, I get times equal to zero, I suppose
because the functions are not executed as they do not have
Hi,
when trying to compare different implementations of the optimized
builds of a pure function using benchmark from
std.datetime.stopwatch, I get times equal to zero, I suppose
because the functions are not executed as they do not have side
effects.
The same happens with the example from