newb question re. reading lines from stdin

aylwyn as6 at sanger.ac.uk
Wed Apr 25 04:10:11 PDT 2012


Hi, I've just written a smallish program reading
lines from stdin and doing some parsing and other text
processing. I find it's about 3-4 times faster than a python
script I had doing the same thing, which is nice but not as good
as I hoped. After profiling, it seems almost half the total time
is being spent in

std.stdio.File.ByLine!(char, char).ByLine.popFront()

called once per line on stdin, and within that mostly in

std.stdio.File.readln!(char).readln(ref char[], dchar)


Before I do some benchmark comparisons with C etc, can I just
check that

foreach (line; stdin.byLine())

is the correct way to do this. Are there any lower-level methods
I could use for buffered access to a stream of chars?

(using DMD64 D Compiler v2.058.)


More information about the Digitalmars-d-learn mailing list