my first D program (and benchmark against perl)
    perlancar via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Nov 12 04:05:18 PST 2015
    
    
  
On Wednesday, 11 November 2015 at 14:26:32 UTC, Andrea Fontana 
wrote:
> Did you try rdmd -O -noboundscheck -release yourscript.d ?
I just did. It improves speed from 17.127s to 14.831s. Nice, but 
nowhere near gdc/ldc level.
> You should try using appender!string rather than concatenate 
> (http://dlang.org/phobos/std_array.html#.Appender) using 
> capacity 
> (http://dlang.org/phobos/std_array.html#.Appender.capacity) to 
> improve performace.
> You should also switch from for to foreach.
Thanks for the above 2 tips.
    
    
More information about the Digitalmars-d-learn
mailing list