handlebars.java
handlebars.java copied to clipboard
Performance issue
I use Wiremock which use your library for templating. I am encountering a problem of performance when I active the reponse templating especially when the response content is important ( start at 250Ko ) By example, for a full text response of 500Kb to parse for handlebar, I got a response time of 21 second ! ( even with the text content 0 function ! )
The visitBody seem to be the problem.
Hi, make sure you install one of the cache implementation: https://github.com/jknack/handlebars.java#the-cache-system
Also, if you attach an example will look later to see if we really can improve something.
Thanks
As I said, I don't use directly handlebar, I use Wiremock which use HandleBars. I can send you example, but it's a Wiremock example. I have open an issue on the Wiremock side too, I will inform them about the cache and try to know if they implement it.
ok, yea no idea what was wiremock. My guess is that there is no cache so ANTLR parses 500kb on every single call.
I'm ok for the cache which could improved performance on multiple call, but 14 second in visitBody to parse 500Kb of text without any {{ }} function to call, I find it really bad.
A solution like this https://github.com/tomakehurst/wiremock/pull/1088 could help on larges files