I'm using StringTemplate to generate some xml files from datasets. Sometimes I have more than 100,000 records in the dataset that is enumerated by a loop in a template. It goes very slow (15-20 secs per operation) so performance is not good for me.
This is an example how I use ST to render a report:
using (var sw = new StringWriter())
{
st.Write(new StringTemplateWriter(sw));
return sw.ToString();
}
StringTemplateWriter is a simple writer-class derived from IStringTemplateWriter without indentation.
By the way, in the debug screen I see a lot of such weird message:
"A first chance exception of type 'antlr.NoViableAltException' occurred in StringTemplate.DLL"
in a deep of debug I found that it parses my template recursively and if something failed (don't know what exactly) it throws NoViableAltException exception to return from a deep of stack back to a surface, so I guess the problem is in using of too much try-catch-throw's.
Google found nothing useful on this.
Main question: how to decrease this number of exceptions (except rewriting the code of ST) and improve performance of template rendering?