%%%------------------------------------------------------------------- %%% File : drop3.erl %%% Author : Per Gustafsson %%% Description : %%% %%% Created : 6 Feb 2006 by Per Gustafsson %%%------------------------------------------------------------------- -module(drop3). -export([test/1,main/2]). %%-------- Code for the benchmark ------------------------------------ drop3(Bin) -> % 1 << <> || <> <= Bin, X>=2#100 >>. % 2 %%---------- Stuff for benchmarking ---------------------------------- -define(ITER,10). test([InName]) -> {ok,Bin} = file:read_file(InName), erlang:spawn_opt(?MODULE,main,[InName,Bin],[{min_heap_size, 1000000}]). main(FileName,B) -> statistics(runtime), Res = iter(?ITER,fun() -> drop3(B) end), {_,T} = statistics(runtime), io:format("~.3f",[T/1000]), file:write_file(FileName++".erlang",[Res]), halt(). iter(1,F) -> F(); iter(N,F) -> F(),iter(N-1,F).