{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/101920299","pull_request_review_id":22661857,"id":101920299,"diff_hunk":"@@ -136,7 +136,7 @@ def expire_fragment(key, options = nil)\n \n       def instrument_fragment_cache(name, key) # :nodoc:\n         payload = instrument_payload(key)\n-        ActiveSupport::Notifications.instrument(\"#{name}.#{instrument_name}\", payload) { yield }\n+        ActiveSupport::Notifications.instrument(\"#{name}.#{instrument_name}\".freeze, payload) { yield }","path":"actionpack/lib/abstract_controller/caching/fragments.rb","position":5,"original_position":5,"commit_id":"dde7134e07cb84f2efcf9704de144ef9ed38d360","original_commit_id":"dde7134e07cb84f2efcf9704de144ef9ed38d360","user":{"login":"matthewd","id":1034,"avatar_url":"https://avatars.githubusercontent.com/u/1034?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewd","html_url":"https://github.com/matthewd","followers_url":"https://api.github.com/users/matthewd/followers","following_url":"https://api.github.com/users/matthewd/following{/other_user}","gists_url":"https://api.github.com/users/matthewd/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewd/subscriptions","organizations_url":"https://api.github.com/users/matthewd/orgs","repos_url":"https://api.github.com/users/matthewd/repos","events_url":"https://api.github.com/users/matthewd/events{/privacy}","received_events_url":"https://api.github.com/users/matthewd/received_events","type":"User","site_admin":false},"body":"> But I think Ruby should also support this behavior?\r\n\r\nNo; it doesn't make any sense. `.freeze` isn't magical go-fast sprinkles: it tells the interpreter to do a particular thing -- store the string, and re-use it each time. If the string's going to have different contents each call, it's just not possible to do that.","created_at":"2017-02-19T15:17:42Z","updated_at":"2017-02-19T15:17:42Z","html_url":"https://github.com/rails/rails/pull/27926#discussion_r101920299","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/27926","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/101920299"},"html":{"href":"https://github.com/rails/rails/pull/27926#discussion_r101920299"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/27926"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/27926","id":104835194,"html_url":"https://github.com/rails/rails/pull/27926","diff_url":"https://github.com/rails/rails/pull/27926.diff","patch_url":"https://github.com/rails/rails/pull/27926.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/27926","number":27926,"state":"closed","locked":false,"title":"Freeze fragment cache related instrument name.","user":{"login":"st0012","id":5079556,"avatar_url":"https://avatars.githubusercontent.com/u/5079556?v=3","gravatar_id":"","url":"https://api.github.com/users/st0012","html_url":"https://github.com/st0012","followers_url":"https://api.github.com/users/st0012/followers","following_url":"https://api.github.com/users/st0012/following{/other_user}","gists_url":"https://api.github.com/users/st0012/gists{/gist_id}","starred_url":"https://api.github.com/users/st0012/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st0012/subscriptions","organizations_url":"https://api.github.com/users/st0012/orgs","repos_url":"https://api.github.com/users/st0012/repos","events_url":"https://api.github.com/users/st0012/events{/privacy}","received_events_url":"https://api.github.com/users/st0012/received_events","type":"User","site_admin":false},"body":"### Summary\r\n\r\n`ActionMailer::Base#instrument_name` and\r\n`ActionController::Base#instrument_name` will be frequently called once\r\ncaching is enabled. So it's better to freeze them instead of creating new\r\nstring on every call.\r\n\r\nAlso, the instrument name in #instrument_fragment_cache will usually\r\nbe `\"write_fragment.action_controller\"` or\r\n`\"read_fragment.action_controller\"`. So freezing them might also gain some\r\nperformance improvement. We have done something like this in other places:\r\nhttps://github.com/rails/rails/blob/master/actionview/lib/action_view/template.rb#L348\r\n","created_at":"2017-02-06T16:44:02Z","updated_at":"2017-02-19T15:17:42Z","closed_at":"2017-02-13T23:53:40Z","merged_at":"2017-02-13T23:53:40Z","merge_commit_sha":"f06ee2a703e8cd7c18f70642f3d1d15a43eeb7ce","assignee":{"login":"schneems","id":59744,"avatar_url":"https://avatars.githubusercontent.com/u/59744?v=3","gravatar_id":"","url":"https://api.github.com/users/schneems","html_url":"https://github.com/schneems","followers_url":"https://api.github.com/users/schneems/followers","following_url":"https://api.github.com/users/schneems/following{/other_user}","gists_url":"https://api.github.com/users/schneems/gists{/gist_id}","starred_url":"https://api.github.com/users/schneems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schneems/subscriptions","organizations_url":"https://api.github.com/users/schneems/orgs","repos_url":"https://api.github.com/users/schneems/repos","events_url":"https://api.github.com/users/schneems/events{/privacy}","received_events_url":"https://api.github.com/users/schneems/received_events","type":"User","site_admin":false},"assignees":[{"login":"schneems","id":59744,"avatar_url":"https://avatars.githubusercontent.com/u/59744?v=3","gravatar_id":"","url":"https://api.github.com/users/schneems","html_url":"https://github.com/schneems","followers_url":"https://api.github.com/users/schneems/followers","following_url":"https://api.github.com/users/schneems/following{/other_user}","gists_url":"https://api.github.com/users/schneems/gists{/gist_id}","starred_url":"https://api.github.com/users/schneems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schneems/subscriptions","organizations_url":"https://api.github.com/users/schneems/orgs","repos_url":"https://api.github.com/users/schneems/repos","events_url":"https://api.github.com/users/schneems/events{/privacy}","received_events_url":"https://api.github.com/users/schneems/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/27926/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/27926/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/27926/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/dde7134e07cb84f2efcf9704de144ef9ed38d360","head":{"label":"st0012:freeze-cache-instrument-name","ref":"freeze-cache-instrument-name","sha":"dde7134e07cb84f2efcf9704de144ef9ed38d360","user":{"login":"st0012","id":5079556,"avatar_url":"https://avatars.githubusercontent.com/u/5079556?v=3","gravatar_id":"","url":"https://api.github.com/users/st0012","html_url":"https://github.com/st0012","followers_url":"https://api.github.com/users/st0012/followers","following_url":"https://api.github.com/users/st0012/following{/other_user}","gists_url":"https://api.github.com/users/st0012/gists{/gist_id}","starred_url":"https://api.github.com/users/st0012/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st0012/subscriptions","organizations_url":"https://api.github.com/users/st0012/orgs","repos_url":"https://api.github.com/users/st0012/repos","events_url":"https://api.github.com/users/st0012/events{/privacy}","received_events_url":"https://api.github.com/users/st0012/received_events","type":"User","site_admin":false},"repo":{"id":47878374,"name":"rails","full_name":"st0012/rails","owner":{"login":"st0012","id":5079556,"avatar_url":"https://avatars.githubusercontent.com/u/5079556?v=3","gravatar_id":"","url":"https://api.github.com/users/st0012","html_url":"https://github.com/st0012","followers_url":"https://api.github.com/users/st0012/followers","following_url":"https://api.github.com/users/st0012/following{/other_user}","gists_url":"https://api.github.com/users/st0012/gists{/gist_id}","starred_url":"https://api.github.com/users/st0012/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st0012/subscriptions","organizations_url":"https://api.github.com/users/st0012/orgs","repos_url":"https://api.github.com/users/st0012/repos","events_url":"https://api.github.com/users/st0012/events{/privacy}","received_events_url":"https://api.github.com/users/st0012/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/st0012/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/st0012/rails","forks_url":"https://api.github.com/repos/st0012/rails/forks","keys_url":"https://api.github.com/repos/st0012/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/st0012/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/st0012/rails/teams","hooks_url":"https://api.github.com/repos/st0012/rails/hooks","issue_events_url":"https://api.github.com/repos/st0012/rails/issues/events{/number}","events_url":"https://api.github.com/repos/st0012/rails/events","assignees_url":"https://api.github.com/repos/st0012/rails/assignees{/user}","branches_url":"https://api.github.com/repos/st0012/rails/branches{/branch}","tags_url":"https://api.github.com/repos/st0012/rails/tags","blobs_url":"https://api.github.com/repos/st0012/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/st0012/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/st0012/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/st0012/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/st0012/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/st0012/rails/languages","stargazers_url":"https://api.github.com/repos/st0012/rails/stargazers","contributors_url":"https://api.github.com/repos/st0012/rails/contributors","subscribers_url":"https://api.github.com/repos/st0012/rails/subscribers","subscription_url":"https://api.github.com/repos/st0012/rails/subscription","commits_url":"https://api.github.com/repos/st0012/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/st0012/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/st0012/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/st0012/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/st0012/rails/contents/{+path}","compare_url":"https://api.github.com/repos/st0012/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/st0012/rails/merges","archive_url":"https://api.github.com/repos/st0012/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/st0012/rails/downloads","issues_url":"https://api.github.com/repos/st0012/rails/issues{/number}","pulls_url":"https://api.github.com/repos/st0012/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/st0012/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/st0012/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/st0012/rails/labels{/name}","releases_url":"https://api.github.com/repos/st0012/rails/releases{/id}","deployments_url":"https://api.github.com/repos/st0012/rails/deployments","created_at":"2015-12-12T13:02:19Z","updated_at":"2016-02-24T15:44:54Z","pushed_at":"2017-02-19T14:59:26Z","git_url":"git://github.com/st0012/rails.git","ssh_url":"git@github.com:st0012/rails.git","clone_url":"https://github.com/st0012/rails.git","svn_url":"https://github.com/st0012/rails","homepage":"http://rubyonrails.org","size":139750,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"e3afc83631ebe2dbb3c4368756577bdd92ea1d62","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","deployments_url":"https://api.github.com/repos/rails/rails/deployments","created_at":"2008-04-11T02:19:47Z","updated_at":"2017-02-19T15:04:12Z","pushed_at":"2017-02-19T15:08:08Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":143086,"stargazers_count":34515,"watchers_count":34515,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14063,"mirror_url":null,"open_issues_count":1285,"forks":14063,"open_issues":1285,"watchers":34515,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/27926"},"html":{"href":"https://github.com/rails/rails/pull/27926"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/27926"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/27926/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/27926/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/27926/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/dde7134e07cb84f2efcf9704de144ef9ed38d360"}}}}
{"actor":{"display_login":"matthewd"}}