how to be faster than perl?
Boris Bukowski
boris.bukowski at lycos-europe.com
Tue Jan 30 04:21:53 PST 2007
Hi,
currently I am testing D for log processing.
My perl script is more than ten times faster than my D Prog.
How can I get Lines faster from a File?
Boris
---snip---
private import std.stream;
private import std.stdio;
private import std.string;
void main (char[][] args) {
int c;
Stream file = new BufferedFile(args[1]);
foreach(ulong n, char[] line; file) {
if(std.regexp.find(line, "horizontal") > -1){
c++;
}
}
writefln("%d", c);
}
---snip---
#!/usr/bin/perl
while($line=<>) {
if ($line=~/horizontal/) {
$c++;
}
}
print "$c\n";
---snip---
More information about the Digitalmars-d-learn
mailing list