stdio performance in tango, stdlib, and perl
Lars Ivar Igesund
larsivar at igesund.net
Thu Mar 22 14:16:44 PDT 2007
Andrei Alexandrescu (See Website For Email) wrote:
> I've ran a couple of simple tests comparing Perl, D's stdlib (the coming
> release), and Tango.
I have uploaded a snapshot with prebuilt libraries to
http://larsivi.net/files/tango-SNAPSHOT-20070322.tar.gz
The prebuilt libraries are in the lib/ folder. Install libphobos.a as usual,
and add libtango.a to your compile command. The test program (io.d below)
should be compiled using the line
dmd -O -release -inline io.d libtango.a
io.d
-------
import tango.io.Console;
void main() {
char[] line;
// true means that newlines are retained
while (Cin.nextLine(line, true))
Cout(line);
}
--------
For the sake of reference, I created a file with 1.8 million (equal) lines,
at a total of 133 Megabytes. I ran it through the above program, and your
Perl program. System is a PentiumM-1.86GHz, 1.5GB RAM, Kubuntu 7.04, DMD
1.009.
Average times perl program : 1.65 seconds (real), 1.45 seconds (user)
Average times tango program: 1.08 seconds (real), 0.91 seconds (user)
Note that I also tried without the optimization flags to DMD, which resulted
in times that were about 10% faster than Perl.
--
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
More information about the Digitalmars-d
mailing list