[erlang-questions] slow file I/O (was Not an Erlang fan)

Bengt Kleberg bengt.kleberg@REDACTED
Fri Sep 28 08:49:28 CEST 2007


greetings,

bfile sounds great. can it do stdin/stdout?


bengt
Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."


On 2007-09-27 20:46, Claes Wikstrom wrote:
> Originally at Bluetail, we had some serious problems with
> high performance file I/O, especially line oriented such.
> 
> I then wrote a portable (yes win32 too) linked in driver
> for fast FILE I/O. It's based on an old and hacked version
> of the BSD FILE* interface. It's called bfile and we've
> been using it in pretty much all projects during the past 8
> years. I've prepared a tarball of it at
> 
> http://yaws.hyber.org/download/bfile-1.0.tgz
> 
> Here's an (slightly edited) example shell session:
> 
> 2> bfile:load_driver().
> ok
> 4> {ok, Fd} = bfile:fopen("Makefile", "r").
> {ok,{bfile,#Port<0.98>}}
> 5> bfile:fgets(Fd).
> {line,<<10>>}
> 6> bfile:fgets(Fd).
> {line,<<10>>}
> 7> bfile:fgets(Fd).
> {line,<<97,108,108,58,32,10>>}
> 14> bfile:fread(Fd, 10000).
> {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,59,32,...>>}
> 15> bfile:fread(Fd, 10000).
> eof
> 
> It should be equally fast as the same code in C.
> 
> Enjoy,
> 
> /klacke
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list