handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

Performance issue

Open max3163 opened this issue 5 years ago • 5 comments

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 ! )

l_3892 tmp

The visitBody seem to be the problem.

max3163 avatar Feb 04 '19 15:02 max3163

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

jknack avatar Feb 04 '19 15:02 jknack

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.

max3163 avatar Feb 04 '19 15:02 max3163

ok, yea no idea what was wiremock. My guess is that there is no cache so ANTLR parses 500kb on every single call.

jknack avatar Feb 04 '19 15:02 jknack

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.

max3163 avatar Feb 04 '19 15:02 max3163

A solution like this https://github.com/tomakehurst/wiremock/pull/1088 could help on larges files

philippe-granet avatar Feb 21 '19 23:02 philippe-granet