{"action":"created","comment":{"url":"https://api.github.com/repos/distribusion/supa/pulls/comments/94592455","pull_request_review_id":15120755,"id":94592455,"diff_hunk":"@@ -1,11 +1,53 @@\n require 'spec_helper'\n+require 'benchmark'\n \n-describe 'Supa Benchmark' do\n-  bench_performance_linear '#to_hash' do |n|\n-    Supa::ArticleRepresenter.new(Supa::Fixtures.article_with_comments(n)).to_hash\n+describe 'Supa Benchmark', 'linear performance' do\n+  def article_representable(article_number)\n+    Supa::ArticleRepresenter.new(Supa::Fixtures.article_with_comments(article_number))\n   end\n \n-  bench_performance_linear '#to_json' do |n|\n-    Supa::ArticleRepresenter.new(Supa::Fixtures.article_with_comments(n)).to_json\n+  def benchmark_execution_time\n+    if block_given?\n+      benchmark_times = (0..5).each_with_object([]) do |i, times|\n+        times << Benchmark.realtime do\n+          yield\n+        end\n+      end\n+      benchmark_times.max\n+    end\n+  end\n+\n+  describe '#to_hash' do\n+    let(:execution_time_10) do\n+      benchmark_execution_time do\n+        article_representable(10).to_hash\n+      end\n+    end\n+    let(:article_representable_50) { article_representable(50) }\n+    let(:article_representable_100) { article_representable(100) }\n+\n+    it '50 articles' do\n+      expect { article_representable_50.to_hash }.to perform_under(execution_time_10 * 5 * 1.05)\n+    end\n+    it '100 articles' do\n+      expect { article_representable_100.to_hash }.to perform_under(execution_time_10 * 10 * 1.05)\n+    end\n+  end\n+\n+  describe '#to_json' do\n+    let(:execution_time_10) do\n+      benchmark_execution_time do","path":"spec/benchmarks/representable_bench.rb","position":44,"original_position":44,"commit_id":"34688a0c5260daedf81dbfea46c81e30bc1cfb14","original_commit_id":"34688a0c5260daedf81dbfea46c81e30bc1cfb14","user":{"login":"Strech","id":920053,"avatar_url":"https://avatars.githubusercontent.com/u/920053?v=3","gravatar_id":"","url":"https://api.github.com/users/Strech","html_url":"https://github.com/Strech","followers_url":"https://api.github.com/users/Strech/followers","following_url":"https://api.github.com/users/Strech/following{/other_user}","gists_url":"https://api.github.com/users/Strech/gists{/gist_id}","starred_url":"https://api.github.com/users/Strech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Strech/subscriptions","organizations_url":"https://api.github.com/users/Strech/orgs","repos_url":"https://api.github.com/users/Strech/repos","events_url":"https://api.github.com/users/Strech/events{/privacy}","received_events_url":"https://api.github.com/users/Strech/received_events","type":"User","site_admin":false},"body":"Can you make it one-line\r\n\r\n```ruby\r\nlet(:execution_time_10) do\r\n  benchmark_execution_time { article_representable(10).to_json }\r\nend\r\n```","created_at":"2017-01-04T14:33:03Z","updated_at":"2017-01-04T14:51:31Z","html_url":"https://github.com/distribusion/supa/pull/2#discussion_r94592455","pull_request_url":"https://api.github.com/repos/distribusion/supa/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/distribusion/supa/pulls/comments/94592455"},"html":{"href":"https://github.com/distribusion/supa/pull/2#discussion_r94592455"},"pull_request":{"href":"https://api.github.com/repos/distribusion/supa/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/distribusion/supa/pulls/2","id":100118917,"html_url":"https://github.com/distribusion/supa/pull/2","diff_url":"https://github.com/distribusion/supa/pull/2.diff","patch_url":"https://github.com/distribusion/supa/pull/2.patch","issue_url":"https://api.github.com/repos/distribusion/supa/issues/2","number":2,"state":"open","locked":false,"title":"migrate from minitest to rspec","user":{"login":"jrietema","id":344432,"avatar_url":"https://avatars.githubusercontent.com/u/344432?v=3","gravatar_id":"","url":"https://api.github.com/users/jrietema","html_url":"https://github.com/jrietema","followers_url":"https://api.github.com/users/jrietema/followers","following_url":"https://api.github.com/users/jrietema/following{/other_user}","gists_url":"https://api.github.com/users/jrietema/gists{/gist_id}","starred_url":"https://api.github.com/users/jrietema/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrietema/subscriptions","organizations_url":"https://api.github.com/users/jrietema/orgs","repos_url":"https://api.github.com/users/jrietema/repos","events_url":"https://api.github.com/users/jrietema/events{/privacy}","received_events_url":"https://api.github.com/users/jrietema/received_events","type":"User","site_admin":false},"body":"no user story... just do it!","created_at":"2017-01-04T13:56:14Z","updated_at":"2017-01-04T14:51:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fbe2872213bc15506df5bb91258c3e41c38b7309","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/distribusion/supa/pulls/2/commits","review_comments_url":"https://api.github.com/repos/distribusion/supa/pulls/2/comments","review_comment_url":"https://api.github.com/repos/distribusion/supa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/distribusion/supa/issues/2/comments","statuses_url":"https://api.github.com/repos/distribusion/supa/statuses/34688a0c5260daedf81dbfea46c81e30bc1cfb14","head":{"label":"distribusion:replace-minitest-with-rspec","ref":"replace-minitest-with-rspec","sha":"34688a0c5260daedf81dbfea46c81e30bc1cfb14","user":{"login":"distribusion","id":10435634,"avatar_url":"https://avatars.githubusercontent.com/u/10435634?v=3","gravatar_id":"","url":"https://api.github.com/users/distribusion","html_url":"https://github.com/distribusion","followers_url":"https://api.github.com/users/distribusion/followers","following_url":"https://api.github.com/users/distribusion/following{/other_user}","gists_url":"https://api.github.com/users/distribusion/gists{/gist_id}","starred_url":"https://api.github.com/users/distribusion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/distribusion/subscriptions","organizations_url":"https://api.github.com/users/distribusion/orgs","repos_url":"https://api.github.com/users/distribusion/repos","events_url":"https://api.github.com/users/distribusion/events{/privacy}","received_events_url":"https://api.github.com/users/distribusion/received_events","type":"Organization","site_admin":false},"repo":{"id":77933853,"name":"supa","full_name":"distribusion/supa","owner":{"login":"distribusion","id":10435634,"avatar_url":"https://avatars.githubusercontent.com/u/10435634?v=3","gravatar_id":"","url":"https://api.github.com/users/distribusion","html_url":"https://github.com/distribusion","followers_url":"https://api.github.com/users/distribusion/followers","following_url":"https://api.github.com/users/distribusion/following{/other_user}","gists_url":"https://api.github.com/users/distribusion/gists{/gist_id}","starred_url":"https://api.github.com/users/distribusion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/distribusion/subscriptions","organizations_url":"https://api.github.com/users/distribusion/orgs","repos_url":"https://api.github.com/users/distribusion/repos","events_url":"https://api.github.com/users/distribusion/events{/privacy}","received_events_url":"https://api.github.com/users/distribusion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/distribusion/supa","description":"Ruby object → JSON serialization.","fork":true,"url":"https://api.github.com/repos/distribusion/supa","forks_url":"https://api.github.com/repos/distribusion/supa/forks","keys_url":"https://api.github.com/repos/distribusion/supa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/distribusion/supa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/distribusion/supa/teams","hooks_url":"https://api.github.com/repos/distribusion/supa/hooks","issue_events_url":"https://api.github.com/repos/distribusion/supa/issues/events{/number}","events_url":"https://api.github.com/repos/distribusion/supa/events","assignees_url":"https://api.github.com/repos/distribusion/supa/assignees{/user}","branches_url":"https://api.github.com/repos/distribusion/supa/branches{/branch}","tags_url":"https://api.github.com/repos/distribusion/supa/tags","blobs_url":"https://api.github.com/repos/distribusion/supa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/distribusion/supa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/distribusion/supa/git/refs{/sha}","trees_url":"https://api.github.com/repos/distribusion/supa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/distribusion/supa/statuses/{sha}","languages_url":"https://api.github.com/repos/distribusion/supa/languages","stargazers_url":"https://api.github.com/repos/distribusion/supa/stargazers","contributors_url":"https://api.github.com/repos/distribusion/supa/contributors","subscribers_url":"https://api.github.com/repos/distribusion/supa/subscribers","subscription_url":"https://api.github.com/repos/distribusion/supa/subscription","commits_url":"https://api.github.com/repos/distribusion/supa/commits{/sha}","git_commits_url":"https://api.github.com/repos/distribusion/supa/git/commits{/sha}","comments_url":"https://api.github.com/repos/distribusion/supa/comments{/number}","issue_comment_url":"https://api.github.com/repos/distribusion/supa/issues/comments{/number}","contents_url":"https://api.github.com/repos/distribusion/supa/contents/{+path}","compare_url":"https://api.github.com/repos/distribusion/supa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/distribusion/supa/merges","archive_url":"https://api.github.com/repos/distribusion/supa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/distribusion/supa/downloads","issues_url":"https://api.github.com/repos/distribusion/supa/issues{/number}","pulls_url":"https://api.github.com/repos/distribusion/supa/pulls{/number}","milestones_url":"https://api.github.com/repos/distribusion/supa/milestones{/number}","notifications_url":"https://api.github.com/repos/distribusion/supa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/distribusion/supa/labels{/name}","releases_url":"https://api.github.com/repos/distribusion/supa/releases{/id}","deployments_url":"https://api.github.com/repos/distribusion/supa/deployments","created_at":"2017-01-03T16:28:24Z","updated_at":"2017-01-03T22:10:50Z","pushed_at":"2017-01-04T14:24:22Z","git_url":"git://github.com/distribusion/supa.git","ssh_url":"git@github.com:distribusion/supa.git","clone_url":"https://github.com/distribusion/supa.git","svn_url":"https://github.com/distribusion/supa","homepage":"","size":55,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"distribusion:master","ref":"master","sha":"6086e38bff8d0b64412e7908a09ff626c3ba0ed8","user":{"login":"distribusion","id":10435634,"avatar_url":"https://avatars.githubusercontent.com/u/10435634?v=3","gravatar_id":"","url":"https://api.github.com/users/distribusion","html_url":"https://github.com/distribusion","followers_url":"https://api.github.com/users/distribusion/followers","following_url":"https://api.github.com/users/distribusion/following{/other_user}","gists_url":"https://api.github.com/users/distribusion/gists{/gist_id}","starred_url":"https://api.github.com/users/distribusion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/distribusion/subscriptions","organizations_url":"https://api.github.com/users/distribusion/orgs","repos_url":"https://api.github.com/users/distribusion/repos","events_url":"https://api.github.com/users/distribusion/events{/privacy}","received_events_url":"https://api.github.com/users/distribusion/received_events","type":"Organization","site_admin":false},"repo":{"id":77933853,"name":"supa","full_name":"distribusion/supa","owner":{"login":"distribusion","id":10435634,"avatar_url":"https://avatars.githubusercontent.com/u/10435634?v=3","gravatar_id":"","url":"https://api.github.com/users/distribusion","html_url":"https://github.com/distribusion","followers_url":"https://api.github.com/users/distribusion/followers","following_url":"https://api.github.com/users/distribusion/following{/other_user}","gists_url":"https://api.github.com/users/distribusion/gists{/gist_id}","starred_url":"https://api.github.com/users/distribusion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/distribusion/subscriptions","organizations_url":"https://api.github.com/users/distribusion/orgs","repos_url":"https://api.github.com/users/distribusion/repos","events_url":"https://api.github.com/users/distribusion/events{/privacy}","received_events_url":"https://api.github.com/users/distribusion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/distribusion/supa","description":"Ruby object → JSON serialization.","fork":true,"url":"https://api.github.com/repos/distribusion/supa","forks_url":"https://api.github.com/repos/distribusion/supa/forks","keys_url":"https://api.github.com/repos/distribusion/supa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/distribusion/supa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/distribusion/supa/teams","hooks_url":"https://api.github.com/repos/distribusion/supa/hooks","issue_events_url":"https://api.github.com/repos/distribusion/supa/issues/events{/number}","events_url":"https://api.github.com/repos/distribusion/supa/events","assignees_url":"https://api.github.com/repos/distribusion/supa/assignees{/user}","branches_url":"https://api.github.com/repos/distribusion/supa/branches{/branch}","tags_url":"https://api.github.com/repos/distribusion/supa/tags","blobs_url":"https://api.github.com/repos/distribusion/supa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/distribusion/supa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/distribusion/supa/git/refs{/sha}","trees_url":"https://api.github.com/repos/distribusion/supa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/distribusion/supa/statuses/{sha}","languages_url":"https://api.github.com/repos/distribusion/supa/languages","stargazers_url":"https://api.github.com/repos/distribusion/supa/stargazers","contributors_url":"https://api.github.com/repos/distribusion/supa/contributors","subscribers_url":"https://api.github.com/repos/distribusion/supa/subscribers","subscription_url":"https://api.github.com/repos/distribusion/supa/subscription","commits_url":"https://api.github.com/repos/distribusion/supa/commits{/sha}","git_commits_url":"https://api.github.com/repos/distribusion/supa/git/commits{/sha}","comments_url":"https://api.github.com/repos/distribusion/supa/comments{/number}","issue_comment_url":"https://api.github.com/repos/distribusion/supa/issues/comments{/number}","contents_url":"https://api.github.com/repos/distribusion/supa/contents/{+path}","compare_url":"https://api.github.com/repos/distribusion/supa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/distribusion/supa/merges","archive_url":"https://api.github.com/repos/distribusion/supa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/distribusion/supa/downloads","issues_url":"https://api.github.com/repos/distribusion/supa/issues{/number}","pulls_url":"https://api.github.com/repos/distribusion/supa/pulls{/number}","milestones_url":"https://api.github.com/repos/distribusion/supa/milestones{/number}","notifications_url":"https://api.github.com/repos/distribusion/supa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/distribusion/supa/labels{/name}","releases_url":"https://api.github.com/repos/distribusion/supa/releases{/id}","deployments_url":"https://api.github.com/repos/distribusion/supa/deployments","created_at":"2017-01-03T16:28:24Z","updated_at":"2017-01-03T22:10:50Z","pushed_at":"2017-01-04T14:24:22Z","git_url":"git://github.com/distribusion/supa.git","ssh_url":"git@github.com:distribusion/supa.git","clone_url":"https://github.com/distribusion/supa.git","svn_url":"https://github.com/distribusion/supa","homepage":"","size":55,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/distribusion/supa/pulls/2"},"html":{"href":"https://github.com/distribusion/supa/pull/2"},"issue":{"href":"https://api.github.com/repos/distribusion/supa/issues/2"},"comments":{"href":"https://api.github.com/repos/distribusion/supa/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/distribusion/supa/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/distribusion/supa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/distribusion/supa/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/distribusion/supa/statuses/34688a0c5260daedf81dbfea46c81e30bc1cfb14"}}}}
{"actor":{"display_login":"Strech"}}