Not sure I understand why plain macros won’t do what you need. Macros don’t have any runtime performance penalty since its just compile time expansion into the code you would have written if you did it without a macro. Why do you need to generate any code at runtime, no doubt its slow. Are you receiving these templates at runtime? If so you shouldn’t be passing them into eval as this is super dangerous (string or quoted expression) and if not you should be using macros.
Please explain your use case a bit more…