1

I found on StringTemplate pages some reference to template compilation (http://www.stringtemplate.org/api/org/stringtemplate/v4/compiler/Compiler.html). The info is rather, let's say, lapidary.

I cannot find any description/tutorial/example on why and how to use template compilation in ST4. I'd like to take advantage of this feature, as I suspect it could be beneficial to performance.

Any pointers?

gruby karol
  • 329
  • 2
  • 11

1 Answers1

3

That class is always used by the StringTemplate 4 implementation. Code using the library does not need to manually enable, configure, or interact with it directly.

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
  • 1
    Does the compilation improve performance or is it done for other purposes? – gruby karol Jun 26 '14 at 06:38
  • 1
    StringTemplate 4 uses a linear bytecode intepreter for rendering instead of an AST-based interpreter (like StringTemplate 3 used). Since there is no alternate implementation of StringTemplate 4 which does not use the bytecode interpreter for rendering, there is no way to directly answer your question. However, StringTemplate 4 does substantially outperform StringTemplate 3, and the improvement is likely due (at least in part) to this difference. – Sam Harwell Jun 26 '14 at 11:31