N-body bench

Stanislav Blinov stanislav.blinov at gmail.com
Thu Jan 30 13:48:33 PST 2014


On Thursday, 30 January 2014 at 21:33:38 UTC, bearophile wrote:

> If a function takes no time to run, and you tweak it, your 
> program is not supposed to go faster.

Right.

>> I was going to compare the asm listings, but C++ seems to have 
>> unrolled and inlined the outer loop right inside main(), and 
>> now I'm slightly lost in it :)
>
> Try using -fkeep-inline-functions.

Thanks.

G++:
http://codepad.org/oOZQw1VQ

LDC:
http://codepad.org/5nHoZL1k


LDC basically generated something that I can only call "one 
straight *whoooosh*"... This reminds me Andrei's talk on (last 
years?) GoingNative ("more instructions is not always slower 
code").


More information about the Digitalmars-d-learn mailing list