<div><span class="gmail_quote">On 9/27/07, <b class="gmail_sendername">Claes Wikstrom</b> <<a href="mailto:klacke@hyber.org">klacke@hyber.org</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>Originally at Bluetail, we had some serious problems with<br>high performance file I/O, especially line oriented such.<br><br>I then wrote a portable (yes win32 too) linked in driver<br>for fast FILE I/O. It's based on an old and hacked version
<br>of the BSD FILE* interface. It's called bfile and we've<br>been using it in pretty much all projects during the past 8<br>years. I've prepared a tarball of it at<br><br><a href="http://yaws.hyber.org/download">
http://yaws.hyber.org/download</a>/bfile-1.0.tgz<br><br>Here's an (slightly edited) example shell session:<br><br>2> bfile:load_driver().<br>ok<br>4> {ok, Fd} = bfile:fopen("Makefile", "r").<br>
{ok,{bfile,#Port<0.98>}}<br>5> bfile:fgets(Fd).<br>{line,<<10>>}<br>6> bfile:fgets(Fd).<br>{line,<<10>>}<br>7> bfile:fgets(Fd).<br>{line,<<97,108,108,58,32,10>>}<br>14> bfile:fread(Fd, 10000).
<br>{ok,<<10,10,105,110,115,116,97,108,108,58,32,97,108,108,10,9,40,99,100,32,99,95,115,114,99</blockquote><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
,59,32,...>>}<br>15> bfile:fread(Fd, 10000).<br>eof<br><br>It should be equally fast as the same code in C.<br></blockquote></div><br><div><div>Very cool! Between this and the regexp library you posted yesterday, the Tim Bray "wide finder" problem has very likely just gotten a whole lot easier.
</div><div><br class="webkit-block-placeholder"></div><div>--steve</div></div>