Erlang argument matching and performance -
any difference between these 2 performance (or other) perspective?
f1(x=whatever) -> ok; (more...)
and
f2(whatever=x) -> ok; (more...)
you can examine code compiler produces compiling -s generates .s file. you'll , can confirm compiler generates same code each of 2 cases.
{function, f1, 1, 12}. {label,11}. {func_info,{atom,test},{atom,f1},1}. {label,12}. {test,is_eq_exact,{f,11},[{x,0},{atom,whatever}]}. return.
personally, find "whatever=x" counter-intuitive , harder read.
Comments
Post a Comment