howto count lines - fast

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 30 23:50:10 PDT 2017


Dne 31.5.2017 v 02:13 Ali Çehreli via Digitalmars-d-learn napsal(a):

> I could not make the D program come close to wc's performance when the 
> data was piped from stdin. A typical run with Daniel Kozak's program:
>
> $ time cat deleteme.txt | wc -l
> 5062176
>
> real    0m0.086s
> user    0m0.068s
> sys    0m0.048s
>
> $ time cat deleteme.txt | ./deneme
> 5062176
>
> real    0m0.174s
> user    0m0.152s
> sys    0m0.072s
>
> Ali
>

How do you compile it? When I use ldc2 -O3  -release -mcpu=bdver1 lc.d 
my code is even faster than wc


More information about the Digitalmars-d-learn mailing list