<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">Re: byLine and byChunk, I don't think these are a good idea on unbuffered files.<br><br>For example, your current implementation will be extremely slow. Reading one char at a time is OK on a buffered file, because most times its just a simple fetch of a char from a buffer. But your implementation reads a single character at a time from the actual file on disk, a very slow operation.<br><br>I think unbuffered files are good for when you want to handle the buffering yourself, or when you want to pass them to child processes.<br><br>-Steve<br><div><br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Lars
Tandle Kyllingstad <lars@kyllingen.net><br><b><span style="font-weight: bold;">To:</span></b> Phobos mailing list <phobos@puremagic.com><br><b><span style="font-weight: bold;">Sent:</span></b> Mon, May 10, 2010 7:40:15 AM<br><b><span style="font-weight: bold;">Subject:</span></b> [phobos] UnbufferedFile, or, abstracting the File ranges<br></font><br>
In the process of designing std.process it has become obvious, as<br>pointed out by Steve, that Phobos needs facilities for unbuffered I/O.<br>To that end, I've started writing an UnbufferedFile type, the current<br>status of which can be seen here:<br><br><span> Code: <a target="_blank" href="http://github.com/kyllingstad/ltk/blob/master/ltk/stdio.d">http://github.com/kyllingstad/ltk/blob/master/ltk/stdio.d</a></span><br><span> Docs: <a target="_blank" href="http://kyllingen.net/code/ltk/doc/stdio.html">http://kyllingen.net/code/ltk/doc/stdio.html</a></span><br><br>(Disclaimer: This is very much a work-in-progress, there's lots of stuff<br>that needs to be added yet, and I'd be surprised if there wasn't lots of<br>room for improvement, performance-wise.)<br><br><br>Now, while writing this it has kind of annoyed me that I have to write<br>new implementations of the byLine and byChunk ranges.
I've personally<br>found them incredibly useful, so I want them in UnbufferedFile, but the<br>ones in std.stdio are tailored for File.<br><br>I therefore suggest we try to abstract these ranges, so they can operate<br>on general types that define a set of primitives such as read(), readc()<br>and readln().<br><br>Are there problems with this? Any comments?<br><br>-Lars<br><br>_______________________________________________<br>phobos mailing list<br><a ymailto="mailto:phobos@puremagic.com" href="mailto:phobos@puremagic.com">phobos@puremagic.com</a><br><span><a target="_blank" href="http://lists.puremagic.com/mailman/listinfo/phobos">http://lists.puremagic.com/mailman/listinfo/phobos</a></span><br></div></div>
</div><br>
</body></html>