aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/mime_responds.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2008-12-27 00:06:57 -0800
committerYehuda Katz <wycats@gmail.com>2008-12-27 00:06:57 -0800
commit4f043a48381c142e308824e3b7e15435a61bbb53 (patch)
treef994f692d15a0d743ad5c2d942e2944fe3ff9140 /actionpack/lib/action_controller/mime_responds.rb
parentf4f8923cf0ef5bd31f9e98cecf4603d0c4bde296 (diff)
downloadrails-4f043a48381c142e308824e3b7e15435a61bbb53.tar.gz
rails-4f043a48381c142e308824e3b7e15435a61bbb53.tar.bz2
rails-4f043a48381c142e308824e3b7e15435a61bbb53.zip
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
Diffstat (limited to 'actionpack/lib/action_controller/mime_responds.rb')
-rw-r--r--actionpack/lib/action_controller/mime_responds.rb8
1 files 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 @@ module ActionController #:nodoc:
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