<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 25 January 2013 10:27, John Colvin <span dir="ltr"><<a href="mailto:john.loughran.colvin@gmail.com" target="_blank">john.loughran.colvin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Friday, 25 January 2013 at 01:41:12 UTC, H. S. Teoh wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
On Thu, Jan 24, 2013 at 03:18:01PM -0800, Walter Bright wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 1/24/2013 1:13 PM, H. S. Teoh wrote:<br>
>On Thu, Jan 24, 2013 at 12:15:07PM -0800, Walter Bright wrote:<br>
>>On 1/24/2013 8:36 AM, H. S. Teoh wrote:<br>
>>>Nevertheless, I also have made the same observation that >>>code<br>
>>>produced by gdc consistently outperforms code produced by >>>dmd.<br>
>>>Usually by about 20-30%, sometimes as much as 50-60%, IME. >>>That's a<br>
>>>pretty big discrepancy for me, esp. when I'm doing >>>compute-intensive<br>
>>>geometric computations.<br>
>><br>
>>Do you mean floating point code? 32 or 64 bit?<br>
><br>
>Floating-point, 64-bit, tested on dmd -O vs. gdc -O3.<br>
<br>
Next, are you using floats, doubles, or reals?<br>
</blockquote>
<br></div></div><div><div class="h5">
Both reals and floats. Well, let's get some real measurements. Here's a<br>
quick run-through of various test programs I have lying around:<br>
<br>
Test program #1 (iterating 2-variable function over grid), uses reals:<br>
- Test case with n=400:<br>
        Using DMD:      ~8 seconds (consistently)<br>
        Using GDC:      ~6 seconds (consistently)<br>
        * So the DMD version is 33% slower than the GDC version.<br>
          (That is, 8/6*100 = 133%, so 33% slower.)<br>
<br>
- Test case with n=600:<br>
        Using DMD:      ~27 seconds (consistently)<br>
        Using GDC:      ~19 seconds (consistently)<br>
        * So the DMD version is 42% slower than the GDC version.<br>
<br>
<br>
Test program #2 (terrain generation simulator), uses floats:<br>
(The running time of this one depends on the RNG, so I fixed the seed<br>
value in order to make a fair comparison.)<br>
- Test case with seed=380170304, n=20 with water & wind simulation:<br>
        Using DMD:      ~10 seconds (consistently)<br>
        Using GDC:      ~7 seconds (consistently)<br>
        * So the DMD version is 42% slower than the GDC version.<br>
<br>
- Test case with seed=380170304, n=25 with water & wind simulation:<br>
        Using DMD:      ~14 seconds (consistently)<br>
        Using GDC:      ~9 seconds (consistently)<br>
        * So the DMD version is 55% slower than the GDC version.<br>
<br>
<br>
Test program #3 (enumeration of coordinates of n-dimensional polytopes),<br>
uses reals:<br>
- All permutations and changes of sign of <1,2,3,4,5,6,7>:<br>
        Using DMD:      ~4 seconds (consistently)<br>
        Using GDC:      ~3 seconds (consistently)<br>
        * So the DMD version is 33% slower than the GDC version.<br>
<br>
- All permutations and changes of sign of <1,2,3,4,5,6,7,7>:<br>
        Using DMD:      ~41 seconds (consistently)<br>
        Using GDC:      ~27 seconds (consistently)<br>
        * So the DMD version is 51% slower than the GDC version.<br>
<br>
- Even permutations and all changes of sign of <1,2,3,4,5,6,7,8>:<br>
        Using DMD:      ~40 seconds (consistently)<br>
        Using GDC:      ~27 seconds (consistently)<br>
        * So the DMD version is 48% slower than the GDC version.<br>
<br>
<br>
All test programs were compiled with dmd -O for the DMD version, and gdc<br>
-O3 for the GDC version. The source code is unchanged between the two<br>
compilers, and there are no version()'s that depend on a particular<br>
compiler. The measurements stated above are averages of about 3-4 runs.<br>
<br>
As you can see, the performance difference is between the two is pretty<br>
clear.  I'm pretty sure this isn't only because of floating point<br>
operations, because the above test programs all use a lot of inner<br>
loops, and GDC does some pretty sophisticated loop unrolling and other<br>
such optimizations.<br>
<br>
<br>
T<br>
</div></div></blockquote>
<br>
Comparing dmd -O and gdc -O3 is hardly fair. "dmd -release -inline -O" is more comparable.<br>
</blockquote></div><br><br></div><div class="gmail_extra">But then you'd have to do gdc -O3 -frelease. :-)<br clear="all"></div><div class="gmail_extra"><br>-- <br>Iain Buclaw<br><br>*(p < e ? p++ : p) = (c & 0x0f) + '0';
</div></div>