我需要从预定义的模板准备消息,我们要构建的系统将在一秒钟内准备100条消息。所以我编写了一个程序,用市场上可用的多个模板框架顺序构建1000条消息
-String template
-Mustache template
-Thymeleaf template
-Rythm template
-Pebble template
-handler template
我用于此性能测试的模板包含一些带有多个if / else,for和substitution语句的逻辑。
按顺序准备1000条消息。其中的最终结果列于下面
String template - 40 seconds
Mustache template - 2 seconds
Thymeleaf template - 15 seconds
Rythm template - 2 seconds
Pebble template - 4 seconds
Handler template - 7 seconds
在这些我相信Rythm模板击败所有其他模板框架。
让我知道您对Rythm模板的看法。使用它有任何缺点。
答案 0 :(得分:1)
嘿,Ryth的作者在这里。感谢您将Rythm纳入您的基准列表。
我对Rythm的理解:
Rythm的好处是可用性,功能集和表现力。
缺点可能是:
答案 1 :(得分:0)
我看到的一个缺点是,如果有任何可以在多个模板中使用的自定义/用户定义函数,那么我们需要在所有模板中编写相同的函数。这是我的理解吗?