[erlang-questions] Finding a way to get function name from local function reference

Sergey S ad.sergey@REDACTED
Thu Jan 22 00:21:15 CET 2009


Hello.

> Yes. I *completely* misread and misunderstood the question <redface>.

Hm... Your suggestion was helpful to me. I've rewritten the module for
testing out performace of fuctions using apply as you suggested.
Thanks.

Sources of the module itself and sample.erl illustrating how to use it
can be found here: http://gist.github.com/50240

bm:funs/4 takes module name, list of function names (or name prefix
which all functions to test begin with), arguments to pass and number
of iterates. Then it tests them and fine prints sorted results:

1> sample:bm().
decompress_2..........1130 (1134) ms.
decompress_1..........1500 (1531) ms.
decompress_3..........1530 (1525) ms.

Of cource, it would be much better to have the possibility of using
function references, but it looks like there is no way to get the
names of them at runtime (in the general case).

--
Sergey



More information about the erlang-questions mailing list