Right, the compiled approach will always be faster. If you have a general template engine, then the compiled approach will be faster and probably simpler.
However, if your template engine is limited (think mustache/handlebars), then I would precompile only the template into a Template AST and not necessarily compile it down to Elixir. Evaluating this template ast should be reasonably fast as long as you rely on IO lists (i.e. never concatenate strings, only keep them in a list).
I am not sure if this helps but these would be my two cents. I would avoid eval generally though.


















