Skip to content

Instantly share code, notes, and snippets.

@fsodogandji
Created January 9, 2014 16:04
Show Gist options
  • Select an option

  • Save fsodogandji/8336636 to your computer and use it in GitHub Desktop.

Select an option

Save fsodogandji/8336636 to your computer and use it in GitHub Desktop.
A Renaud's powered bench :)
f(F),F=fun(N)->S=self(),G=fun(_,0,_,L)->L;(G1,N1,Ref,L)->receive {Ref, Ret}-> G1(G1,N1-1,Ref,[Ret|L]) end end,
Ref=erlang:make_ref(),L=[random:uniform(1000)||_<-lists:seq(1,N)],
FW=fun()->S ! {Ref,lists:foldl(fun(J,A)->lists:sort(L) end,1,L)} end,
{T,_V}=timer:tc(fun()->[spawn( FW )||_I <-L],G(G,length(L),Ref,[]) end),T/1000 end.
F(100).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment