Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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/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

like image 317
allenhwkim Avatar asked Feb 24 '11 19:02

allenhwkim


1 Answers

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.

like image 182
archaelus Avatar answered Oct 20 '22 23:10

archaelus