From 274d05b6c8a85f66b79f0ec8338f7cfcd51f0939 Mon Sep 17 00:00:00 2001 From: "Hongli Lai (Phusion)" Date: Mon, 18 Aug 2008 13:46:38 +0200 Subject: [PATCH] Fix the dispatcher benchmark program. --- benchmark/dispatcher.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/benchmark/dispatcher.rb b/benchmark/dispatcher.rb index 1b079e9a85..760ad67e95 100755 --- a/benchmark/dispatcher.rb +++ b/benchmark/dispatcher.rb @@ -2,16 +2,15 @@ # Benchmark raw speed of the Rails dispatcher. PASSENGER_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..") $LOAD_PATH << "#{PASSENGER_ROOT}/lib" +$LOAD_PATH << "#{PASSENGER_ROOT}/ext" ENV["RAILS_ENV"] = "production" require 'yaml' require 'benchmark' -require 'passenger/request_handler' require 'config/environment' +require 'passenger/railz/cgi_fixed' require 'dispatcher' -include Passenger - class OutputChannel def write(data) # Black hole @@ -25,7 +24,7 @@ def start(iterations) milestone = 1 if milestone == 0 result = Benchmark.measure do iterations.times do |i| - cgi = CGIFixed.new(headers, output, STDOUT) + cgi = Passenger::Railz::CGIFixed.new(headers, output, output) ::Dispatcher.dispatch(cgi, ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, cgi.stdoutput) @@ -39,8 +38,5 @@ def start(iterations) end puts "Benchmark started." -t = Thread.new do - #start(ARGV[0] ? ARGV[0].to_i : 1000) -end -start(ARGV[0] ? ARGV[0].to_i : 1000) -t.join +start(ARGV[0] ? ARGV[0].to_i : 2000) +