Skip to content

Commit

Permalink
Fix the dispatcher benchmark program.
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Aug 18, 2008
1 parent 4998cea commit 274d05b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions benchmark/dispatcher.rb
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)

0 comments on commit 274d05b

Please sign in to comment.