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

remove Set.new from DetailsKey::get, impacts rendering overhead performance

Using ruby-prof, I noticed that Set#add had the largest 'self time'
percentage (5% of the overall time spent rendering) when
benchmarking the rendering of a small cached ERB template that was 3
lines long. It turns out it was from this line. I don't believe the
Set is necessary, either. Removing this line increases the rendering
ips using Benchmark::ips accordingly.
This commit is contained in:
Luke Gruber 2014-06-25 23:18:33 -04:00
parent 18def156ba
commit 4955c04eb6

View file

@ -66,7 +66,7 @@ module ActionView
def self.get(details) def self.get(details)
if details[:formats] if details[:formats]
details = details.dup details = details.dup
syms = Set.new Mime::SET.symbols syms = Mime::SET.symbols
details[:formats] = details[:formats].select { |v| details[:formats] = details[:formats].select { |v|
syms.include? v syms.include? v
} }