TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: JStachio a type-safe Mustache engine that is incredible fast

3 点作者 agentgt将近 2 年前
Hi HN,<p>I have been working on a Java template engine that is type-safe and uses Mustache for syntax. I developed it because my company has been using Mustache (and handlebars) heavily for a decade now and I always wished there was a type-safe version.<p>It is fully compliant to the v1.3 Mustache spec which had some unique challenges given that JStachio is not late binding like most Mustache implementations as well as templates cannot be dynamically changed like most implementations.<p>After almost a year it is ready for 1.0.0 which I hope to do this week.<p>It has been production ready for some time but I took extra time on documentation, getting the API right and real world benchmarking.<p>It generates readable Java code once the templates are compiled and thus very Graal VM Native friendly.<p>It is the fastest templating engine for Java.<p>I know that is a bold statement but unlike others I not only tested with JMH doing String output but also with TechEmpower&#x27;s Framework benchmarks.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;agentgt&#x2F;template-benchmark">https:&#x2F;&#x2F;github.com&#x2F;agentgt&#x2F;template-benchmark</a><p>Speaking of TechEmpower If you have a framework on TechEmpower that is Java performing the Fortune benchmark I recommend picking JStachio.<p>It was not my intention to be the fastest but I did benchmarking to make sure my 1.0.0 API would be future proof (always good to make sure the API does not prevent going fast).<p>Anyway I have some really exciting future plans on dealing with polymorphic data with Mustache&#x27;s dynamic name&#x2F;partial support. In Javascript this is accomplished with String fields being the name of the template. In JStachio this will be done with annotated sealed classes (yes Java is slowly getting sort of ADT&#x2F;sum types) which is safer and will exhaust all sub types.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;jstachio&#x2F;jstachio&#x2F;issues&#x2F;140">https:&#x2F;&#x2F;github.com&#x2F;jstachio&#x2F;jstachio&#x2F;issues&#x2F;140</a><p>Check it out and let me know what you think!

暂无评论

暂无评论