带有erubis模板引擎的Ruby 2.1

我们正在寻找用于渲染视图的最快模板引擎。

据我所知,erubis是ruby中最快的模板引擎。

我的用例是通过脚本渲染模板。

查看gem官方页面,它的最新版本是在2011年。不确定社区是否活跃。 https://rubygems.org/gems/erubis/versions

有没有人使用ruby 2.1与erubis模板引擎?

是否建议使用erubis和ruby 2.1?

谢谢Abhay

我使用下面的代码片段在ERB和erubis渲染之间运行基准测试。

 erubis_render_time = Benchmark.realtime { template_content = File.read("#{Rails.root}/app/views/web/email_templates/erubis_benchmark_test.erb") 1000.times do |j| email_body = Erubis::Eruby.new(template_content).result({welcome_mail_cta: "Shop Now", welcome_mail_string: "Welcome. Your account is activated"}) end } template_path = "/web/email_templates/benchmark_test" erb_render_time = Benchmark.realtime { 1000.times do |j| email_body = ActionController::Base.new.send(:render_to_string, :template => template_path, :layout => false, :locals => {:data => {welcome_mail_cta: "Shop Now", welcome_mail_string: "Welcome. Your account is activated" } } ) end } 

按照上述基准套件,Erubis比ERB渲染快10-15倍。