Skip to content

Commit

Permalink
ERB should respect CACHED env var in benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Oct 11, 2009
1 parent 2037983 commit 612cd48
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions benchmarks/speed.rb
Expand Up @@ -15,8 +15,10 @@
erb.result(ComplexView.new.send(:binding))
end

bench 'ERB w/o caching' do
ERB.new(template).result(ComplexView.new.send(:binding))
unless ENV['CACHED']
bench 'ERB w/o caching' do
ERB.new(template).result(ComplexView.new.send(:binding))
end
end
end

Expand All @@ -35,14 +37,14 @@

tpl[:item] = items

bench '{ w/ caching' do
bench '{ w/ caching' do
tpl.to_html
end

content = File.read(ComplexView.template_file)

unless ENV['CACHED']
bench '{ w/o caching' do
bench '{ w/o caching' do
ctpl = ComplexView.new
ctpl.template = content
ctpl[:item] = items
Expand Down

0 comments on commit 612cd48

Please sign in to comment.