Template Caching

CodeSmith Generator uses a technique called template caching to speed up the process time of generating templates. If the template's content and dependencies have not changed, CodeSmith Generator is able to use the already compiled assembly to render the template's output, rather than recompiling the template.

For CodeSmith Generator to be able to use template caching, the template must be unchanged since the last time it was compiled. To determine this, CodeSmith Generator checks the source code of the template for changes, and also recurses into any templates and source files referenced through Assembly or Register directives.

Template caching makes a big difference in the performance of CodeSmith Generator when you're repeatedly executing the same template without modifying the template itself. You'll see a nice performance boost when you just execute a template (the Properties window will open more quickly), but the real benefit comes when you integrate CodeSmith Generator into your build process. With template caching, using CodeSmith Generator through the batch generation process or CodeSmith Generator Console Application is substantially faster.