From 4f043a48381c142e308824e3b7e15435a61bbb53 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sat, 27 Dec 2008 00:06:57 -0800 Subject: [PATCH] More optimizations on respond_to after a profile and benching: App with simple respond_to: def index respond_to do |format| format.html format.xml format.json end end On JRuby (after complete hotspot warmup) -- 8% improvement: 550 requests per second after this commit 510 requests per second with old method_missing technique On MRI (8% improvement): 430 requests per second after this commit 400 requests per second with old method_missing technique --- actionpack/lib/action_controller/mime_responds.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/actionpack/lib/action_controller/mime_responds.rb b/actionpack/lib/action_controller/mime_responds.rb index 76fcae5f51..55cb212a10 100644 --- a/actionpack/lib/action_controller/mime_responds.rb +++ b/actionpack/lib/action_controller/mime_responds.rb @@ -147,13 +147,9 @@ def any(*args, &block) def self.generate_method_for_mime(mime) sym = mime.is_a?(Symbol) ? mime : mime.to_sym const = sym.to_s.upcase - class_eval <<-RUBY + class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{sym}(&block) # def html(&block) - if Mime::SET.include?(Mime::#{const}) # if Mime::Set.include?(Mime::HTML) - custom(Mime::#{const}, &block) # custom(Mime::HTML, &block) - else # else - super # super - end # end + custom(Mime::#{const}, &block) # custom(Mime::HTML, &block) end # end RUBY end -- GitLab