<div dir="ltr">On my machine D is faster than his c++ version, so It does look good. I use his own repository so I do not know why his results are so different in my case:<div><br></div><div>his c++ version with gcc:</div><div><br></div><div><div>real<span style="white-space:pre"> </span>0m0,021s</div><div>user<span style="white-space:pre"> </span>0m0,021s</div><div>sys<span style="white-space:pre"> </span>0m0,000s</div><div><br></div><div>his D version with DMD:</div><div><div>real<span style="white-space:pre"> </span>0m0,018s</div><div>user<span style="white-space:pre"> </span>0m0,015s</div><div>sys<span style="white-space:pre"> </span>0m0,004s</div></div><div><br></div><div><div>his D version with GDC:</div><div><div>real<span style="white-space:pre"> </span>0m0,015s</div><div>user<span style="white-space:pre"> </span>0m0,006s</div><div>sys<span style="white-space:pre"> </span>0m0,010s</div></div></div><div><br></div><div>his D version with LDC:<br></div><div><div>real<span style="white-space:pre"> </span>0m0,030s</div><div>user<span style="white-space:pre"> </span>0m0,025s</div><div>sys<span style="white-space:pre"> </span>0m0,005s</div></div><div><br></div><div>LDC is slower because on my system it use shared phobos library, so it takes some time to load it.</div><div>all others (gcc,gdc and dmd use static libs)</div><div><br></div><div>When I use shared phobos for dmd, I get</div><div><div>real<span style="white-space:pre"> </span>0m0,032s</div><div>user<span style="white-space:pre"> </span>0m0,024s</div><div>sys<span style="white-space:pre"> </span>0m0,009s</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 7, 2017 at 1:00 PM, Jonathan M Davis via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thursday, December 07, 2017 09:55:56 Antonio Corbi via Digitalmars-d<br>
wrote:<br>
<span class="">> Hello all,<br>
><br>
> Jussi Pakkanen (one of the meson build system creators) has<br>
> written a post comparing C, C++ and D. Worth a read.<br>
><br>
> <a href="http://nibblestew.blogspot.com.es/2017/12/comparing-c-c-and-d-performance-" rel="noreferrer" target="_blank">http://nibblestew.blogspot.<wbr>com.es/2017/12/comparing-c-c-<wbr>and-d-performance-</a>> with.html<br>
<br>
</span>Honestly, I find the results a bit depressing, but a lot of that probably<br>
stems from the fact that it's not idiomatic D code, and any time you do more<br>
or less direct conversions, you run the risk of things not working as<br>
efficiently due to differences in the languages involved. The author does<br>
acknowledge that, but without refactoring the code to be more idiomatic, it<br>
makes D look bad - though the fact that it does better with memory than C or<br>
C++ does make the GC look better than you'd necessarily expect. It's<br>
certainly surprising that the GC is the _good_ part of the results.<br>
<br>
I do wonder what the results would look like with clang and ldc though,<br>
particularly since the version of gdc in Ubuntu is going to be pretty old.<br>
It might make no difference at all, or there could be a definite<br>
improvement, depending on what his code is doing and what has changed since<br>
the last gdc release.<br>
<br>
- Jonathan M Davis<br>
<br>
</blockquote></div><br></div>