开发者

erlang template engine. sgte, google-cTemplate, or erlydtl

开发者 https://www.devze.com 2023-02-13 11:52 出处:网络
I am planning to implement a template engine to my erlang project, and the most important thing is the performance. Currently I have a lot of Velocity Java template, and I want to migrate templates av

I am planning to implement a template engine to my erlang project, and the most important thing is the performance. Currently I have a lot of Velocity Java template, and I want to migrate templates available to erlang.

I googled it, and found things like;

  • http://www.ivan.fomichev.name/2008/05/开发者_C百科erlang-template-engine-prototype.html
  • erlydtl
  • google-ctemplate
  • sgte

Pure erlang implementation would be the best, but c(c++) based template engine, i.e. google-ctemplate, performs better, I would use it with erlang linked in driver.

Have no experience on this matter yet, so anyone's suggestions would be super great.

thanks


My personal favourite is erlydtl. It compiles the template to an erlang module, so there's no filesystem access or parsing time consumed when you call 'render'.

I think rebar has erlydtl support these days, so getting your templates compiled is a lot less hassle than it used to be. Just name them *.dtl and they'll get built when you run rebar compile.

It should also be fairly competitive speed wise as it's in-process (skip the IPC cost of a port program), compiled (and could be compiled to native code if you wanted to), and generates iolists which are pretty efficient.

0

精彩评论

暂无评论...
验证码 换一张
取 消