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

Engine performance #1073

Open
raymank26 opened this issue May 21, 2023 · 2 comments
Open

Engine performance #1073

raymank26 opened this issue May 21, 2023 · 2 comments

Comments

@raymank26
Copy link

raymank26 commented May 21, 2023

Given a com.hubspot.jinjava.Jinjava#renderForResult method it seems that every time a template is rendered the String template is parsed using JinjavaInterpreter#render->parse methods each time.

Could you clarify why the rendering routine doesn't use some sort of a TemplateId->Node cache to reuse the parsed AST in the rendering step? Are there any obstacles to implement that?

@jasmith-hs
Copy link
Contributor

This is something that someone can make themselves using and caching JinjavaInterpreter#parse and calling JinjavaInterpreter#render. But it would be interesting to explore making that within com.hubspot.jinjava.Jinjava too

@proxo
Copy link

proxo commented Jul 17, 2023

If reusing of Interpreter/Node is recommended for performance gain, than how to safely replace bindings before a next render ?
Sth like interpreter.getContext.putAll(newBindings) ?

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

No branches or pull requests

3 participants