Jump to page: 1 2 3
Thread overview
summing large arrays - or - performance of tight loops
Apr 18, 2007
Thomas Kuehne
Apr 18, 2007
Craig Black
Apr 18, 2007
Thomas Kuehne
Apr 18, 2007
Craig Black
Apr 18, 2007
Dan
Apr 23, 2007
Thomas Kuehne
Apr 18, 2007
Dave
Apr 19, 2007
Craig Black
Apr 19, 2007
Dan
Apr 19, 2007
Dave
Apr 19, 2007
Manfred Nowak
Apr 19, 2007
Dave
Apr 23, 2007
Thomas Kuehne
Apr 23, 2007
Dan
Apr 23, 2007
Thomas Kuehne
Apr 23, 2007
Dave
Apr 19, 2007
Dave
Apr 23, 2007
Dave
Apr 18, 2007
Dave
Apr 18, 2007
torhu
Apr 18, 2007
Manfred Nowak
April 18, 2007
I've done a few tests on how DMD and GDC handle tight loops and was surprised by the slow code DMD generates for "foreach".

results and source code: http://dstress.kuehne.cn/benchmark/tight_loops/sum.html

Thomas


April 18, 2007
Not Found

The requested URL /benchmark/tight_loops/sum.html was not found on this server.

-Craig


April 18, 2007
That link is dead.
April 18, 2007
Thomas Kuehne wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I've done a few tests on how DMD and GDC handle tight loops and was surprised by the slow code DMD generates for "foreach".
> 
> results and source code: http://dstress.kuehne.cn/benchmark/tight_loops/sum.html
> 
> Thomas
> 
> 
> -----BEGIN PGP SIGNATURE-----
> 
> iD8DBQFGJkFyLK5blCcjpWoRAgM4AJ9JnbxtHTlBFwXdWfwfcuShxi/2iACfVaxI
> ULxRdOI+28mzZXCbv8RiPO8=
> =Z0K0
> -----END PGP SIGNATURE-----

Invalid URL. I tried looking at http://dstress.kuehne.cn/benchmark/ and there is not even a tight_loops directory!
April 18, 2007
Craig Black schrieb am 2007-04-18:
> Not Found
>
> The requested URL /benchmark/tight_loops/sum.html was not found on this server.

Seems to be some server issue, backup can be found here: http://svn.berlios.de/svnroot/repos/dstress/trunk/benchmark/tight_loops/sum.html

Thomas


April 18, 2007
Good work on this.  It is certainly a problem for Walter if he sticks with his "trust the compiler" philiosphy.  Since the DMD documentation claims that foreach should emit optimized code, and it clearly doesn't in these cases, I think you could submit this as a bug.

-Craig


April 18, 2007
Indeed, this is clearly an optimization problem.  I agree that we should put our faith in the compiler because it's bad to undermine it to try to write optimal code when the compiler may still be improved to solve the problem *properly*

That said, DMDScript undermines associative arrays by completely re-implementing them with a tweak - instead of using opIndex and opIndexAssign.  : p

But yes, let's work on getting the compiler to Do The Right Thing(tm) so we don't have to kludge our code, mm?
April 18, 2007
Craig Black wrote:
> Good work on this.  It is certainly a problem for Walter if he sticks with his "trust the compiler" philiosphy.  Since the DMD documentation claims 

Walter consistently mentioned that a) most of the DM compiler back-end is 20 years old and b) is not optimized for D yet. I think the "trust the compiler" philosophy is for stability (20 years old), not optimizations. Plus for integer stuff it seems to do pretty well (GCC is no slouch).

That said, both foreach and FP should perform better!

> that foreach should emit optimized code, and it clearly doesn't in these cases, I think you could submit this as a bug.
> 
> -Craig 
> 
April 18, 2007
Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Craig Black schrieb am 2007-04-18:
>> Not Found
>>
>> The requested URL /benchmark/tight_loops/sum.html was not found on this server.
> 
> Seems to be some server issue, backup can be found here:
> http://svn.berlios.de/svnroot/repos/dstress/trunk/benchmark/tight_loops/sum.html
> 
> Thomas
> 

Nice, but didn't the 'result' variable overflow several times during the loop for the int tests?

> 
> -----BEGIN PGP SIGNATURE-----
> 
> iD8DBQFGJkfJLK5blCcjpWoRAnMnAJ0dabQGW2edXBXlXVbXqqUSlgUmjACgqJUh
> kh2pP8ZmgultrR2U+Cusgyc=
> =tUSf
> -----END PGP SIGNATURE-----
April 18, 2007
Thomas Kuehne wrote

surprised by the slow code DMD generates for "foreach".

Not confirmed.

On my machine foreach is about 15% faster than pointer_2a.

-manfred
« First   ‹ Prev
1 2 3