Skip to content

Problems with your tests #1

@jneto81

Description

@jneto81

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions