{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/36510056","id":36510056,"diff_hunk":"@@ -164,7 +164,7 @@ def deconstantize\n   #\n   #   <%= link_to(@person.name, person_path) %>\n   #   # => <a href=\"/person/1-donald-e-knuth\">Donald E. Knuth</a>\n-  def parameterize(sep = '-')\n+  def parameterize(sep = '-'.freeze)","path":"activesupport/lib/active_support/core_ext/string/inflections.rb","position":5,"original_position":5,"commit_id":"22f592401444a83b7b2d3c2165ac666d69955d08","original_commit_id":"22f592401444a83b7b2d3c2165ac666d69955d08","user":{"login":"kgrz","id":400299,"avatar_url":"https://avatars.githubusercontent.com/u/400299?v=3","gravatar_id":"","url":"https://api.github.com/users/kgrz","html_url":"https://github.com/kgrz","followers_url":"https://api.github.com/users/kgrz/followers","following_url":"https://api.github.com/users/kgrz/following{/other_user}","gists_url":"https://api.github.com/users/kgrz/gists{/gist_id}","starred_url":"https://api.github.com/users/kgrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgrz/subscriptions","organizations_url":"https://api.github.com/users/kgrz/orgs","repos_url":"https://api.github.com/users/kgrz/repos","events_url":"https://api.github.com/users/kgrz/events{/privacy}","received_events_url":"https://api.github.com/users/kgrz/received_events","type":"User","site_admin":false},"body":"Yes. More cleaner, IMO. That was what I wanted to convey when I first posted the comment. Evidently, I wasn't clear. Sorry about that.","created_at":"2015-08-07T11:20:41Z","updated_at":"2015-08-07T11:20:41Z","html_url":"https://github.com/rails/rails/pull/21057#discussion_r36510056","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/21057","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/36510056"},"html":{"href":"https://github.com/rails/rails/pull/21057#discussion_r36510056"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/21057"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/21057","id":41146907,"html_url":"https://github.com/rails/rails/pull/21057","diff_url":"https://github.com/rails/rails/pull/21057.diff","patch_url":"https://github.com/rails/rails/pull/21057.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/21057","number":21057,"state":"closed","locked":false,"title":"Beyond Ludicrous Speed","user":{"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},"body":"I've been working on quite a few performance improvements to Rails and the Rails ecosystem, but this is by far the single biggest set of improvements I've been able to make. Those other changes have maybe shaved off a few objects here and there, and maybe 1 or 2% faster request time if I'm extremely lucky.\r\n\r\nThis change shaves off **34,299** objects and **3,457,318** bytes (3.29 MiB) allocated on every request. This is a **29%** decrease in objects and a **23%** decrease in memory allocated per request. Taking us past ludicrous speed...\r\n\r\n![](http://i.stack.imgur.com/mNA4dm.jpg)\r\n\r\nSo just how much does this improve overall request time? To measure I used http://www.codetriage.com as an example app and https://github.com/schneems/derailed_benchmarks to generate load. I hit the app with 1,000 requests with my patch and then 1,000 requests against Rails master. I repeated several times until I saw a fairly stable standard deviation. \r\n\r\nThe average time for 1,000 request against master was 221.88 seconds and against this patch was 195.401 seconds. This gives us a...\r\n\r\n#### 11.9 % speed improvement\r\n\r\nWhere does that speed improvement come from? The big theme is not allocating objects when we don't need to. I used `$ derailed exec perf:objects` which uses [memory_profiler](https://github.com/SamSaffron/memory_profiler) to look for large pockets of allocated memory against http://www.codetriage.com. You can get an in-depth explanation of each change in the commit along with a benchmark of objects and memory saved. The largest area I was able to make gains on was link generation, by removing extraneous arrays, duplicated hashes, and getting rid of intermediate objects whenever possible. I measured this speedup directly:\r\n\r\n```ruby\r\n# $ bin/rails console\r\n\r\nrequire 'benchmark/ips'\r\nrepo = Repo.first\r\n\r\nBenchmark.ips do |x|\r\n  x.report(\"url_for speed\") {\r\n    app.url_for(repo)\r\n  }\r\nend\r\n```\r\n\r\nThis showed 2,865 iterations per second on master and 4,143 iterations per second on my patch. Which is a **44% speed improvement** in url generation.\r\n\r\nThese performance improvements preserve existing interfaces and behaviors, all tests pass.\r\n","created_at":"2015-07-29T16:59:13Z","updated_at":"2015-08-07T11:20:41Z","closed_at":"2015-07-30T18:00:15Z","merged_at":"2015-07-30T18:00:15Z","merge_commit_sha":"2c08646a674fcd00909a93957c3cfc099c61a8da","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/21057/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/21057/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/21057/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/22f592401444a83b7b2d3c2165ac666d69955d08","head":{"label":"schneems:schneems/journey-formatter-objects","ref":"schneems/journey-formatter-objects","sha":"22f592401444a83b7b2d3c2165ac666d69955d08","user":{"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},"repo":{"id":2873136,"name":"rails","full_name":"schneems/rails","owner":{"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},"private":false,"html_url":"https://github.com/schneems/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/schneems/rails","forks_url":"https://api.github.com/repos/schneems/rails/forks","keys_url":"https://api.github.com/repos/schneems/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/schneems/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/schneems/rails/teams","hooks_url":"https://api.github.com/repos/schneems/rails/hooks","issue_events_url":"https://api.github.com/repos/schneems/rails/issues/events{/number}","events_url":"https://api.github.com/repos/schneems/rails/events","assignees_url":"https://api.github.com/repos/schneems/rails/assignees{/user}","branches_url":"https://api.github.com/repos/schneems/rails/branches{/branch}","tags_url":"https://api.github.com/repos/schneems/rails/tags","blobs_url":"https://api.github.com/repos/schneems/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/schneems/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/schneems/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/schneems/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/schneems/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/schneems/rails/languages","stargazers_url":"https://api.github.com/repos/schneems/rails/stargazers","contributors_url":"https://api.github.com/repos/schneems/rails/contributors","subscribers_url":"https://api.github.com/repos/schneems/rails/subscribers","subscription_url":"https://api.github.com/repos/schneems/rails/subscription","commits_url":"https://api.github.com/repos/schneems/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/schneems/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/schneems/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/schneems/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/schneems/rails/contents/{+path}","compare_url":"https://api.github.com/repos/schneems/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/schneems/rails/merges","archive_url":"https://api.github.com/repos/schneems/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/schneems/rails/downloads","issues_url":"https://api.github.com/repos/schneems/rails/issues{/number}","pulls_url":"https://api.github.com/repos/schneems/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/schneems/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/schneems/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/schneems/rails/labels{/name}","releases_url":"https://api.github.com/repos/schneems/rails/releases{/id}","created_at":"2011-11-29T06:48:49Z","updated_at":"2015-01-08T18:17:54Z","pushed_at":"2015-07-30T17:33:25Z","git_url":"git://github.com/schneems/rails.git","ssh_url":"git@github.com:schneems/rails.git","clone_url":"https://github.com/schneems/rails.git","svn_url":"https://github.com/schneems/rails","homepage":"http://rubyonrails.org","size":133896,"stargazers_count":2,"watchers_count":2,"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":2,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"70009e31005220ddacce0a27a2908858be268a0a","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}","created_at":"2008-04-11T02:19:47Z","updated_at":"2015-08-07T09:24:23Z","pushed_at":"2015-08-07T10:09:57Z","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":433309,"stargazers_count":27181,"watchers_count":27181,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10901,"mirror_url":null,"open_issues_count":902,"forks":10901,"open_issues":902,"watchers":27181,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/21057"},"html":{"href":"https://github.com/rails/rails/pull/21057"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/21057"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/21057/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/21057/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/21057/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/22f592401444a83b7b2d3c2165ac666d69955d08"}}}}