Sha256: 6dfdacb7aa2e4981d896f9499324859f7150f6bedc5d0d26260bd68d0a287bcd
Contents?: true
Size: 998 Bytes
Versions: 4
Compression:
Stored size: 998 Bytes
Contents
require 'erb' $LOAD_PATH.unshift File.dirname(__FILE__) require 'helper' $LOAD_PATH.unshift File.dirname(__FILE__) + '/../examples' require 'complex_view' ## erb template = File.read(File.dirname(__FILE__) + '/complex.erb') unless ENV['NOERB'] erb = ERB.new(template) bench 'ERB w/ caching' do erb.result(ComplexView.new.send(:binding)) end bench 'ERB w/o caching' do ERB.new(template).result(ComplexView.new.send(:binding)) end end ## mustache tpl = ComplexView.new tpl.template tpl[:header] = 'Chris' tpl[:empty] = false tpl[:list] = true items = [] items << { :name => 'red', :current => true, :url => '#Red' } items << { :name => 'green', :current => false, :url => '#Green' } items << { :name => 'blue', :current => false, :url => '#Blue' } tpl[:item] = items bench '{ w/ caching' do tpl.to_html end content = File.read(ComplexView.template_file) bench '{ w/o caching' do tpl = ComplexView.new tpl.template = content tpl[:item] = items tpl.to_html end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mustache-0.1.4 | benchmarks/speed.rb |
mustache-0.1.3 | benchmarks/speed.rb |
mustache-0.1.2 | benchmarks/speed.rb |
mustache-0.1.1 | benchmarks/speed.rb |