[erlang-questions] log_roller log parsing / binary match speeds
Antonio SJ Musumeci
bile@REDACTED
Wed Aug 15 16:29:47 CEST 2012
I've been using log_roller for a project and want to be able to dump
the binary files as erlang terms in plain text.
Looking through the log_roller code I found the below which works but
seems rather slow. My question is: is this expected performance? Is
there anything I can do to speed this up?
loop(<<16#FF:8, 16#FF:8, 16#FF:8, 16#FF:8, LogSize:16/integer,
Log:LogSize/binary, 16#EE:8, 16#EE:8, 16#EE:8, 16#EE:8,
Tail/binary>>) ->
% process log
loop(Tail);
loop(<<>>) ->
ok.
On a 2.3GHz Xeon this is taking 25 seconds for a 100MB file. The
binary is sourced by calling file:read_file/1. It's being run as an
escript.
thanks
More information about the erlang-questions
mailing list