optimization questions

Gaspar Chilingarov nm@REDACTED
Mon May 8 22:55:18 CEST 2006


Can erlang vm's gurus tell me which case is more efficient

R = size(Binary),

[ SomeFunction(R, X)  || X <- lists:seq(1, 1000) ]


[ SomeFunction(size(Binary), X)  || X <- lists:seq(1, 1000) ]

so - does compiler and vm understand that some parts of recursion are
constant and move their calculation outside of recursion or I should do
it by hand?

In c/perl practice I prefer to do such optimization by hand, what about

Another issue - what if size(BInary) changed to ... say self() - I mean
that fetching binar sze may be faster operation than creating variable
and accessign it every time.

Tnanks in advance.

Gaspar Chilingarov

System Administrator,
Network security consulting

t +37491 419763 (mob)
i 63174784

More information about the erlang-questions mailing list