my first D program (and benchmark against perl)

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 12 04:24:55 PST 2015


V Thu, 12 Nov 2015 12:13:10 +0000
perlancar via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
napsáno:

> On Wednesday, 11 November 2015 at 14:20:51 UTC, Rikki Cattermole 
> wrote:
> > I turned it into mostly using large allocations, instead of 
> > small ones.
> > Although I'd recommend using Appender instead of my custom 
> > functions for this.
> >
> > Oh and for me, I got it at 2 secs, 513 ms, 397 μs, and 5 
> > hnsecs. Unoptimized, using dmd.
> > When release mode is enabled on dmd: 1 sec, 550 ms, 838 μs, and 
> > 9 hnsecs. So significant improvement even with dmds awful 
> > optimizer.  
> 
> Hi Rikki,
> 
> Thanks. With your version, I've managed to be ~4x faster:
> 
> dmd          : 0m1.588s
> dmd (release): 0m1.010s
> gdc          : 0m2.093s
> ldc          : 0m1.594s
> 
> Perl version : 0m11.391s
> 
> So, I'm satisfied enough with the speed for now. Turns out dmd is 
> not always slower.

It depends which flags do you use on ldc and gdc


ldc (-singleobj -release -O3 -boundscheck=off)
gdc (-O3 -finline -frelease -fno-bounds-check)



More information about the Digitalmars-d-learn mailing list