The Wayback Machine - https://web.archive.org/web/20201123102331/https://github.com/thymeleaf/thymeleaf/issues/780
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider providing an option for fully-initialized TemplateEngine #780

Open
izeye opened this issue Feb 28, 2020 · 0 comments
Open

Consider providing an option for fully-initialized TemplateEngine #780

izeye opened this issue Feb 28, 2020 · 0 comments

Comments

@izeye
Copy link

@izeye izeye commented Feb 28, 2020

TemplateEngine seems to be fully-initialized when TemplateEngine.process() is called. I don't know what happens for the TemplateEngine initialization behind the scene, but TemplateEngine.initialize() is not allowed to be called directly, so I triggered it via TemplateEngine.getConfiguration(). It seems to provide an initialized state but it doesn't seem to be fully-initialized. I could trigger the fully-initialized state via invoking TemplateEngine.process() with a dummy template, but It would be nice if it could be achieved with an option.

TemplateEngineTimingTests.test() (Default) gives the following numbers:

Elapsed time: 672 // first request to template 1
Elapsed time: 2 // first request to template 2

TemplateEngineInitializeTimingTests.test() (Invoked TemplateEngine.getConfiguration() in advance) gives the following numbers:

Elapsed time: 196 // first request to template 1
Elapsed time: 1 // first request to template 2

TemplateEngineDummyInitTimingTests.test() (Invoked TemplateEngine.process() with a dummy template in advance) gives the following numbers:

Elapsed time: 706 // first request to a dummy template
Elapsed time: 8 // first request to template 1
Elapsed time: 2 // first request to template 2

The above mentioned tests are here: https://github.com/izeye/samples-java-branches/tree/master/src/test/java/learningtest/org/thymeleaf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.