On Fri, Jan 25, 2013 at 04:09:25PM +0100, John Colvin wrote:
On Friday, 25 January 2013 at 13:38:03 UTC, Iain Buclaw wrote:
>On 25 January 2013 10:27, John Colvin
><[email protected]>wrote:
>
[...]
>>Comparing dmd -O and gdc -O3 is hardly fair. "dmd -release
>>-inline -O" is more comparable.
>>
>
>
>But then you'd have to do gdc -O3 -frelease. :-)
Ah yes, of course :)
Hmm. I didn't realize that dmd has a separate switch for
function
inlining. Well, here's the updated numbers:
>>On Friday, 25 January 2013 at 01:41:12 UTC, H. S. Teoh wrote:
>>>Both reals and floats. Well, let's get some real
>>>measurements.
>>>Here's a quick run-through of various test programs I have
>>>lying
>>>around:
>>>
>>>Test program #1 (iterating 2-variable function over grid),
>>>uses reals:
>>>- Test case with n=400:
>>> Using DMD: ~8 seconds (consistently)
>>> Using GDC: ~6 seconds (consistently)
>>> * So the DMD version is 33% slower than the GDC
>>>version.
>>> (That is, 8/6*100 = 133%, so 33% slower.)
Updated: DMD version with -inline takes ~7 seconds
consistently, so we
have 7/6*100 = 116%, so 16% slower.
>>>- Test case with n=600:
>>> Using DMD: ~27 seconds (consistently)
>>> Using GDC: ~19 seconds (consistently)
>>> * So the DMD version is 42% slower than the GDC
>>>version.
Updated: DMD version with -inline takes ~24 seconds
consistently, so 26%
slower.
>>>Test program #2 (terrain generation simulator), uses floats:
>>>(The running time of this one depends on the RNG, so I fixed
>>>the seed
>>>value in order to make a fair comparison.)
>>>- Test case with seed=380170304, n=20 with water & wind
>>>simulation:
>>> Using DMD: ~10 seconds (consistently)
>>> Using GDC: ~7 seconds (consistently)
>>> * So the DMD version is 42% slower than the GDC
>>>version.
Updated: DMD version with -inline takes ~8 seconds
consistently, so 14%
slower.
>>>- Test case with seed=380170304, n=25 with water & wind
>>>simulation:
>>> Using DMD: ~14 seconds (consistently)
>>> Using GDC: ~9 seconds (consistently)
>>> * So the DMD version is 55% slower than the GDC
>>>version.
Updated: DMD version with -inline takes ~11 seconds
consistently, so
22% slower.
>>>Test program #3 (enumeration of coordinates of n-dimensional
>>>polytopes),
>>>uses reals:
>>>- All permutations and changes of sign of <1,2,3,4,5,6,7>:
>>> Using DMD: ~4 seconds (consistently)
>>> Using GDC: ~3 seconds (consistently)
>>> * So the DMD version is 33% slower than the GDC
>>>version.
Updated: DMD version with -inline still takes ~4 seconds, so no
significant change here.
>>>- All permutations and changes of sign of <1,2,3,4,5,6,7,7>:
>>> Using DMD: ~41 seconds (consistently)
>>> Using GDC: ~27 seconds (consistently)
>>> * So the DMD version is 51% slower than the GDC
>>>version.
Updated: DMD version with -inline takes about 36 seconds on
average, so
about 33% slower.
>>>- Even permutations and all changes of sign of
>>><1,2,3,4,5,6,7,8>:
>>> Using DMD: ~40 seconds (consistently)
>>> Using GDC: ~27 seconds (consistently)
>>> * So the DMD version is 48% slower than the GDC
>>>version.
Updated: DMD version with -inline takes about 38 seconds, so
41% slower.
Conclusions:
- The performance gap is smaller than previously thought, but
it's still
present.
- I will be using -inline with dmd aggressively.
- What other dmd options am I missing that will bring dmd on
par with
gdc -O3 (if there are any)?
T