List = [1,2,3,4,5,6,7,8,9,10],
_Ret = [{a, Elem} || Elem <- List].
mhelp() ->
List = [1,2,3,4,5,6,7,8,9,10],
mhelp(List, []).
mhelp([], List) ->
lists:reverse(List);
mhelp([E|Rest], List) ->
mhelp(Rest, [{a, E}|List]).
test_main() ->
statistics(wall_clock),
for(1, 100000, fun(_) -> main() end),
{_, Time} = statistics(wall_clock),
?print("test time = ~w", [Time]).
test_mhelp() ->
statistics(wall_clock),
for(1, 100000, fun(_) -> mhelp() end),
{_, Time} = statistics(wall_clock),
?print("test time = ~w", [Time]).
或者timer:tc(t, test_main, []).