[erlang-questions] dynamic compilation of funs

Martin Dimitrov <>
Tue Apr 24 09:51:34 CEST 2012


I am looking at the dynamic_compile module developed by Mats Cronqvist,
Chris Newcombe and Jacob Vorreuter. It has a function evaluate/1 which
uses erl_parse to compile the code. I successfully manage to compile and
use this way a fun. But going through eprof I start to realize that
erl_parse has quite a lot of overhead and is inefficient for our needs.

So what are my other options? I can use dynamic_compile to compile the
functions into a module. But during the execution of the program new
functions need to be dynamically compile. How can I achieve that? Can I
add a function to the dynamically compiled module or I need to recompile
the whole thing again?

Thank you very much for looking at this.

Best regards,


More information about the erlang-questions mailing list