I'm writing a mercurial extension, but am finding that template rendering is rather slow.
I was originally using cmdutil.rendertemplate(), however, it seems that has to reparse the template string every time, which is rather slow.
When switching to the "new" api for @templatekeyword, it looks like the first arg passed is a mercurial.templater.engine object, which has an expand method that caches the parsed versions of templates, which makes it much faster. Unfortunately, it doesn't expand aliases.
Does anyone know the Right Way to efficiently render templates and aliases for a mercurial extension? Right now, the only option I see is copy/pasting the portions of cmdutil.rendertemplate and keeping my own global cache...but that feels pretty icky.
Suppose you need to
[templates]section,the current way is to put the loaded template to
templater.cache[name]first [1], and render it bycontext.process(name, mapping)[2].I'm not sure if that's the case you're facing. There might be a better way depending on context.