-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I found this rep from your article
https://medium.com/naukri-engineering/is-your-java-template-taking-forever-to-render-86776b8224f3
and run the tests cause from my experience jtwig performs better than your test results and i'm also trying no migrate to pebble because jtwig it's no longer maintained.
I found 2 problems in your code.
jtwigOneTimeConfigs() is called every request
JtwigTemplate jtwigTemplate = new JtwigTemplate(jtwigOneTimeConfigs(), resource);
So, it's not using the jtwig templates cache and is evaluating the template every request.
The same happens for pebble
PebbleEngine engine = pebbleOneTimeConfigs();
In devel mode, its important to ignore the templates cache, but for your tests you should use a singleton to store the template configs like in production mode. With this change, you can get 10x more speed in the rendering.