mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Freeze fragment cache related instrument name.
ActionMailer::Base#instrument_name and ActionController::Base#instrument_name will be frequently called once caching is enabled. So it's better to freeze them instead of create new string on every call. Also, the instrument name in #instrument_fragment_cache will usually be "write_fragment.action_controller" or "read_fragment.action_controller". So freezing them might also gain some performance improvement. We have done something like this in other places: https://github.com/rails/rails/blob/master/actionview/lib/action_view/template.rb#L348
This commit is contained in:
parent
e3afc83631
commit
dde7134e07
3 changed files with 3 additions and 3 deletions
|
@ -972,7 +972,7 @@ module ActionMailer
|
|||
end
|
||||
|
||||
def instrument_name
|
||||
"action_mailer"
|
||||
"action_mailer".freeze
|
||||
end
|
||||
|
||||
ActiveSupport.run_load_hooks(:action_mailer, self)
|
||||
|
|
|
@ -136,7 +136,7 @@ module AbstractController
|
|||
|
||||
def instrument_fragment_cache(name, key) # :nodoc:
|
||||
payload = instrument_payload(key)
|
||||
ActiveSupport::Notifications.instrument("#{name}.#{instrument_name}", payload) { yield }
|
||||
ActiveSupport::Notifications.instrument("#{name}.#{instrument_name}".freeze, payload) { yield }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ module ActionController
|
|||
end
|
||||
|
||||
def instrument_name
|
||||
"action_controller"
|
||||
"action_controller".freeze
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue