Are there performance implications if I am using dynamically created templates?


So I am thinking of having a helper which would be internally calling new Blaze.Template to wrap an existing template and returning that. The question I have is if this is problematic. So does anywhere in Blaze code system checks for reference equality. So for example, if I would be returning from the helper, then new call to my helper would have the same reference equality than the old one. Is there a code path which checks for this and then optimizes? Or does Blaze does not care if previous template returned is the same as new one?

The reason is that I could introduce a cache internally, just to make sure the reference is the same, if the created new template would semantically be the same as some old already created one. But I wonder if it is worth it.

I am asking because in Blaze in template helpers it is like that that if returned value is the same as it was returned previously, nothing is rerendered. Is it the same for {{> helperWhichReturnsTemplate}}? And how exactly is the equality done?