Fix benchmark script

Bring benchmark.rb up to date.

 * Update paths in benchmark.rb and Rakefile (benchmark.rb is now in top
   level, not in test).
 * Add "rails" to requre list (needed for version check).
 * Use current api when adding view path to ActionView.base.
This commit is contained in:
Matt Wildig 2012-06-03 17:58:23 +01:00
parent 3f3cb8a2e6
commit c5131dcb59
2 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ end
desc "Benchmark Haml against ERb. TIMES=n sets the number of runs, default is 1000."
task :benchmark do
sh "ruby test/benchmark.rb #{ENV['TIMES']}"
sh "ruby benchmark.rb #{ENV['TIMES']}"
end
Rake::TestTask.new do |t|

View File

@ -13,12 +13,12 @@ END
exit 1
end
%w[rubygems erb erubis active_support action_controller
%w[rubygems erb erubis rails active_support action_controller
action_view action_pack haml/template rbench].each {|dep| require(dep)}
def view
base = ActionView::Base.new
base.finder.append_view_path(File.dirname(__FILE__))
base.view_paths << File.join(File.dirname(__FILE__), '/test')
base
end
@ -33,8 +33,8 @@ RBench.run(times) do
column :erubis, :title => "Erubis"
template_name = 'standard'
haml_template = File.read("#{File.dirname(__FILE__)}/templates/#{template_name}.haml")
erb_template = File.read("#{File.dirname(__FILE__)}/erb/#{template_name}.erb")
haml_template = File.read("#{File.dirname(__FILE__)}/test/templates/#{template_name}.haml")
erb_template = File.read("#{File.dirname(__FILE__)}/test/erb/#{template_name}.erb")
report "Cached" do
obj = Object.new