In my experience, the: read / 2 file will be very slow if it is often called with small amounts of data, despite read_ahead and raw . You must implement a binary buffer on top of this. If this is meant by block-oriented processing, I agree.
I am talking about the running time of several hours (with file: read / 2 only) compared to 2 minutes (with buffering implemented in pure Erlang).
Here are my measurements for reading several 10 bytes at once:
%% Bufsize vs. runtime [ns] %% 50 169369703 %% 100 118288832 %% 1000 70187233 %% 10000 64615506 %% 100000 65087411 %% 1000000 64747497
In this example, the performance does not actually exceed the buffer size of 10 KB, since the relative overhead for the file: reading becomes quite small.
tzp
source share