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
This commit is contained in:
parent
f4f8923cf0
commit
4f043a4838
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user