How to accelerate this program?

Dave Dave_member at pathlink.com
Mon Apr 3 21:30:05 PDT 2006


In article <e0sltd$2cl7$1 at digitaldaemon.com>, Li Jie says...
>
>In article <e0re95$12mg$1 at digitaldaemon.com>, Dave says...
>>
>>
>>From what I've seen, the bottleneck is probably in I/O. Use BufferedFile and a
>>buffer for each readline. On my system with a file made of 440,000 lines of
>>(just 4 repeated) seperate emails, this version takes ~200 ms vs. ~800 ms for
>>your C++ version. Buffering I/O is key in D w/ the phobos I/O routines, as the
>>built-in AA's are pretty fast.
>>
>>Let us know your results (you'll have a lot more AA inserts and email dups).
>>Note you have to dup the string when you insert into your AA.
>>
>>Try this (dmd v0.150):
>
>Thanks Dave.
>
>But it takes ~3400 ms on my system, on windows and gentoo.
>

There's something screwy going on there... Even if I .dup every line of a 880000
line file with average size e-mails in it, I'm still getting 2x better
performance than your C++ version, more in line with this:

http://shootout.alioth.debian.org/gp4/benchmark.php?test=knucleotide&lang=all

which has similiar operations as your test (I/O and hash table update).

I'm using g++ v4.02 and -O3 -fomit-frame-pointer -funroll-loops -mtune=pentium4.

Please send:

- the output from 'dmd -v' 
- output from 'll /usr/lib/libphobos.a'.
- what type of system is 'your system'
- how large is the email file in bytes
- which c++ compiler and flags are you using?
- dmd compiler flags for your test.

There are other ways to make the D code faster but a little less
straight-forward. See the above benchmark site for those.

Thanks.





More information about the Digitalmars-d mailing list