|
|
| Author |
Message |
< Erlang ~ Function definition efficiency question |
| jwatte |
Posted: Wed Mar 03, 2010 4:07 am |
|
|
|
User
Joined: 10 Feb 2010
Posts: 34
|
Is there an efficiency difference between these two implementations? And if there is, any explanation, clarification and depth you can provide would be apprecated.
Code:
min(A, B) when A < B ->
A;
min(_, B) ->
B.
min(A, B) ->
if
A < B -> A;
true -> B
end.
|
|
|
| Back to top |
|
| bpuzon |
Posted: Fri Mar 05, 2010 12:05 pm |
|
|
|
User
Joined: 05 Aug 2009
Posts: 23
Location: Cracow, Poland
|
| I've done some measurements under R13B03 and it seems equal. It's probably compiled to the same bytecode. |
_________________ Saludos,
Bartłomiej Puzoń
Erlang Solutions |
|
| Back to top |
|
| jwatte |
Posted: Fri Mar 05, 2010 5:15 pm |
|
|
|
User
Joined: 10 Feb 2010
Posts: 34
|
| Thanks for your answer! That's good to know. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|