1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

This change causes some failing tests, but it should be possible to make them pass with minimal performance impact.

This commit is contained in:
Yehuda Katz 2009-08-09 07:14:24 -03:00
parent 0a558b36eb
commit 04d4537cd4
3 changed files with 20 additions and 15 deletions

View file

@ -91,6 +91,8 @@ class HttpPostController < ActionController::Metal
end end
end end
ActionController::Base.use_accept_header = false
unless ENV["PROFILE"] unless ENV["PROFILE"]
Runner.run(BasePostController.action(:overhead), N, 'overhead', false) Runner.run(BasePostController.action(:overhead), N, 'overhead', false)
Runner.run(BasePostController.action(:index), N, 'index', false) Runner.run(BasePostController.action(:index), N, 'index', false)
@ -108,10 +110,10 @@ unless ENV["PROFILE"]
Runner.run(BasePostController.action(:show_template), N, 'template') Runner.run(BasePostController.action(:show_template), N, 'template')
end end
else else
Runner.run(BasePostController.action(:many_partials), N, 'many_partials') Runner.run(BasePostController.action(ENV["PROFILE"].to_sym), N, ENV["PROFILE"])
require "ruby-prof" require "ruby-prof"
RubyProf.start RubyProf.start
Runner.run(BasePostController.action(:many_partials), N, 'many_partials') Runner.run(BasePostController.action(ENV["PROFILE"].to_sym), N, ENV["PROFILE"])
result = RubyProf.stop result = RubyProf.stop
printer = RubyProf::CallStackPrinter.new(result) printer = RubyProf::CallStackPrinter.new(result)
printer.print(File.open("output.html", "w")) printer.print(File.open("output.html", "w"))

View file

@ -176,17 +176,18 @@ module ActionDispatch
# Expand raw_formats by converting Mime::ALL to the Mime::SET. # Expand raw_formats by converting Mime::ALL to the Mime::SET.
# #
def formats def formats
if ActionController::Base.use_accept_header return raw_formats
raw_formats.tap do |ret| # if ActionController::Base.use_accept_header
if ret == ONLY_ALL # raw_formats.tap do |ret|
ret.replace Mime::SET # if ret == ONLY_ALL
elsif all = ret.index(Mime::ALL) # ret.replace Mime::SET
ret.delete_at(all) && ret.insert(all, *Mime::SET) # elsif all = ret.index(Mime::ALL)
end # ret.delete_at(all) && ret.insert(all, *Mime::SET)
end # end
else # end
raw_formats + Mime::SET # else
end # raw_formats + Mime::SET
# end
end end
# Sets the \format by string extension, which can be used to force custom formats # Sets the \format by string extension, which can be used to force custom formats

View file

@ -41,8 +41,10 @@ module ActionView
end end
def handler_glob def handler_glob
e = TemplateHandlers.extensions.map{|h| ".#{h},"}.join @handler_glob ||= begin
"{#{e}}" e = TemplateHandlers.extensions.map{|h| ".#{h},"}.join
"{#{e}}"
end
end end
def formats_glob def formats_glob