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

Add Rocker style pre-encoding for JStachio #2921

Merged
merged 1 commit into from
May 19, 2023

Conversation

agentgt
Copy link
Contributor

@agentgt agentgt commented May 16, 2023

@jknack I have updated the JStachio module so that it can take advantage of pre-encoding (the static parts of the template are generated as bytes[] in advance).

The reason I did this is that in the techempower benchmarks Rocker performed better than JStachio's naive String.getBytes().

I also have added threadlocal buffering and removed setting charset.

Setting the charset was a bad idea anyway as JStachio unlike others cannot always re-read the template from the filesystem furthermore escaping is naturally tied to charset.

I noticed that Rocker just assumes MediaType.html (and thus UTF-8) so I have done likewise.

I just released jstachio 0.17.0 but it will take an hour or so before central shows it.

Copy link
Member

@jknack jknack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agentgt did you see the Guice release?

We should pick 7.0.0 right?

@agentgt
Copy link
Contributor Author

agentgt commented May 17, 2023

@agentgt did you see the Guice release?

We should pick 7.0.0 right?

I assume you mean the DI framework. Yes I think so.

@agentgt
Copy link
Contributor Author

agentgt commented May 17, 2023

@jknack

Here are the benchmarking results for JStachio to hopefully prove it as an OK replacement for Rocker in the TechEmpower benchmarks.

https://github.com/agentgt/template-benchmark/blob/utf8/README.md

I also ran the techempower benchmarks with older Jooby and backport of JStachio module and got similar results albeit the difference not as noticeable.

@jknack jknack added this to the 3.0.0.M8 milestone May 17, 2023
@jknack
Copy link
Member

jknack commented May 17, 2023

@agentgt you need to rebase

@agentgt
Copy link
Contributor Author

agentgt commented May 17, 2023

@jknack I will tomorrow morning. I just noticed the conflict. Sorry about that.

@jknack jknack merged commit 12f3ba4 into jooby-project:3.x May 19, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants