{"action":"created","comment":{"url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/comments/72918076","id":72918076,"diff_hunk":"@@ -0,0 +1,72 @@\n+require 'uri'\n+require 'net/http'\n+require 'json'\n+\n+class BenchmarkRegressionJob < ActiveJob::Base\n+  queue_as :default\n+\n+  @@highest = Hash.new(10000) # any max value\n+  @@flag = Hash.new(false)\n+\n+  def perform(benchmark_run_id)\n+\n+    benchmark_run = BenchmarkRun.find_by_id(benchmark_run_id)\n+\n+    categories = benchmark_run.result.keys\n+\n+    current_commit = benchmark_run.initiator\n+    previous_commits = Commit.where('created_at < ?', current_commit.created_at).where(repo: current_commit.repo).limit(1000)\n+\n+    previous_benchmark_runs = []\n+    previous_commits.each do |commit|\n+      previous_benchmark_runs << BenchmarkRun.find_by(initiator: commit, benchmark_type: benchmark_run.benchmark_type,","path":"app/jobs/benchmark_regression_job.rb","position":20,"original_position":22,"commit_id":"2a9e1e256bd17679c1af0379774616c5cc70e1c9","original_commit_id":"4a3c55ad62a718eaf243fdbaee55550680067d50","user":{"login":"tgxworld","id":4335742,"avatar_url":"https://avatars.githubusercontent.com/u/4335742?v=3","gravatar_id":"","url":"https://api.github.com/users/tgxworld","html_url":"https://github.com/tgxworld","followers_url":"https://api.github.com/users/tgxworld/followers","following_url":"https://api.github.com/users/tgxworld/following{/other_user}","gists_url":"https://api.github.com/users/tgxworld/gists{/gist_id}","starred_url":"https://api.github.com/users/tgxworld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgxworld/subscriptions","organizations_url":"https://api.github.com/users/tgxworld/orgs","repos_url":"https://api.github.com/users/tgxworld/repos","events_url":"https://api.github.com/users/tgxworld/events{/privacy}","received_events_url":"https://api.github.com/users/tgxworld/received_events","type":"User","site_admin":false},"body":"https://secure.phabricator.com/book/phabcontrib/article/n_plus_one/","created_at":"2016-08-01T02:26:03Z","updated_at":"2016-08-01T02:26:03Z","html_url":"https://github.com/ruby-bench/ruby-bench-web/pull/174#discussion_r72918076","pull_request_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174","_links":{"self":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/comments/72918076"},"html":{"href":"https://github.com/ruby-bench/ruby-bench-web/pull/174#discussion_r72918076"},"pull_request":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174"}}},"pull_request":{"url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174","id":76264132,"html_url":"https://github.com/ruby-bench/ruby-bench-web/pull/174","diff_url":"https://github.com/ruby-bench/ruby-bench-web/pull/174.diff","patch_url":"https://github.com/ruby-bench/ruby-bench-web/pull/174.patch","issue_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/issues/174","number":174,"state":"open","locked":false,"title":"Detecting benchmark regressions","user":{"login":"shahsaurabh0605","id":11133421,"avatar_url":"https://avatars.githubusercontent.com/u/11133421?v=3","gravatar_id":"","url":"https://api.github.com/users/shahsaurabh0605","html_url":"https://github.com/shahsaurabh0605","followers_url":"https://api.github.com/users/shahsaurabh0605/followers","following_url":"https://api.github.com/users/shahsaurabh0605/following{/other_user}","gists_url":"https://api.github.com/users/shahsaurabh0605/gists{/gist_id}","starred_url":"https://api.github.com/users/shahsaurabh0605/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shahsaurabh0605/subscriptions","organizations_url":"https://api.github.com/users/shahsaurabh0605/orgs","repos_url":"https://api.github.com/users/shahsaurabh0605/repos","events_url":"https://api.github.com/users/shahsaurabh0605/events{/privacy}","received_events_url":"https://api.github.com/users/shahsaurabh0605/received_events","type":"User","site_admin":false},"body":"Added a method to detect benchmark regressions. This fetches the result of last 10 commits from the database and compares with the newly created result. ","created_at":"2016-07-05T12:19:02Z","updated_at":"2016-08-01T02:26:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3a7d5284020bf29f0bc3ee85303e387b2cacf8c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174/commits","review_comments_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174/comments","review_comment_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/issues/174/comments","statuses_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/statuses/2a9e1e256bd17679c1af0379774616c5cc70e1c9","head":{"label":"shahsaurabh0605:diverged3","ref":"diverged3","sha":"2a9e1e256bd17679c1af0379774616c5cc70e1c9","user":{"login":"shahsaurabh0605","id":11133421,"avatar_url":"https://avatars.githubusercontent.com/u/11133421?v=3","gravatar_id":"","url":"https://api.github.com/users/shahsaurabh0605","html_url":"https://github.com/shahsaurabh0605","followers_url":"https://api.github.com/users/shahsaurabh0605/followers","following_url":"https://api.github.com/users/shahsaurabh0605/following{/other_user}","gists_url":"https://api.github.com/users/shahsaurabh0605/gists{/gist_id}","starred_url":"https://api.github.com/users/shahsaurabh0605/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shahsaurabh0605/subscriptions","organizations_url":"https://api.github.com/users/shahsaurabh0605/orgs","repos_url":"https://api.github.com/users/shahsaurabh0605/repos","events_url":"https://api.github.com/users/shahsaurabh0605/events{/privacy}","received_events_url":"https://api.github.com/users/shahsaurabh0605/received_events","type":"User","site_admin":false},"repo":{"id":60519960,"name":"ruby-bench-web","full_name":"shahsaurabh0605/ruby-bench-web","owner":{"login":"shahsaurabh0605","id":11133421,"avatar_url":"https://avatars.githubusercontent.com/u/11133421?v=3","gravatar_id":"","url":"https://api.github.com/users/shahsaurabh0605","html_url":"https://github.com/shahsaurabh0605","followers_url":"https://api.github.com/users/shahsaurabh0605/followers","following_url":"https://api.github.com/users/shahsaurabh0605/following{/other_user}","gists_url":"https://api.github.com/users/shahsaurabh0605/gists{/gist_id}","starred_url":"https://api.github.com/users/shahsaurabh0605/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shahsaurabh0605/subscriptions","organizations_url":"https://api.github.com/users/shahsaurabh0605/orgs","repos_url":"https://api.github.com/users/shahsaurabh0605/repos","events_url":"https://api.github.com/users/shahsaurabh0605/events{/privacy}","received_events_url":"https://api.github.com/users/shahsaurabh0605/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shahsaurabh0605/ruby-bench-web","description":"Long Running Ruby Benchmarks","fork":true,"url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web","forks_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/forks","keys_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/teams","hooks_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/hooks","issue_events_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/issues/events{/number}","events_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/events","assignees_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/assignees{/user}","branches_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/branches{/branch}","tags_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/tags","blobs_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/statuses/{sha}","languages_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/languages","stargazers_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/stargazers","contributors_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/contributors","subscribers_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/subscribers","subscription_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/subscription","commits_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/contents/{+path}","compare_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/merges","archive_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/downloads","issues_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/issues{/number}","pulls_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/pulls{/number}","milestones_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/milestones{/number}","notifications_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/labels{/name}","releases_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/releases{/id}","deployments_url":"https://api.github.com/repos/shahsaurabh0605/ruby-bench-web/deployments","created_at":"2016-06-06T10:34:25Z","updated_at":"2016-06-06T10:34:27Z","pushed_at":"2016-07-31T13:06:13Z","git_url":"git://github.com/shahsaurabh0605/ruby-bench-web.git","ssh_url":"git@github.com:shahsaurabh0605/ruby-bench-web.git","clone_url":"https://github.com/shahsaurabh0605/ruby-bench-web.git","svn_url":"https://github.com/shahsaurabh0605/ruby-bench-web","homepage":"https://rubybench.org","size":4866,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"ruby-bench:master","ref":"master","sha":"929cbb610457a574ea9b33600e9d14883a3e7959","user":{"login":"ruby-bench","id":6201139,"avatar_url":"https://avatars.githubusercontent.com/u/6201139?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-bench","html_url":"https://github.com/ruby-bench","followers_url":"https://api.github.com/users/ruby-bench/followers","following_url":"https://api.github.com/users/ruby-bench/following{/other_user}","gists_url":"https://api.github.com/users/ruby-bench/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-bench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-bench/subscriptions","organizations_url":"https://api.github.com/users/ruby-bench/orgs","repos_url":"https://api.github.com/users/ruby-bench/repos","events_url":"https://api.github.com/users/ruby-bench/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-bench/received_events","type":"Organization","site_admin":false},"repo":{"id":26815515,"name":"ruby-bench-web","full_name":"ruby-bench/ruby-bench-web","owner":{"login":"ruby-bench","id":6201139,"avatar_url":"https://avatars.githubusercontent.com/u/6201139?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-bench","html_url":"https://github.com/ruby-bench","followers_url":"https://api.github.com/users/ruby-bench/followers","following_url":"https://api.github.com/users/ruby-bench/following{/other_user}","gists_url":"https://api.github.com/users/ruby-bench/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-bench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-bench/subscriptions","organizations_url":"https://api.github.com/users/ruby-bench/orgs","repos_url":"https://api.github.com/users/ruby-bench/repos","events_url":"https://api.github.com/users/ruby-bench/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-bench/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-bench/ruby-bench-web","description":"Long Running Ruby Benchmarks","fork":false,"url":"https://api.github.com/repos/ruby-bench/ruby-bench-web","forks_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/forks","keys_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/teams","hooks_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/hooks","issue_events_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/events","assignees_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/tags","blobs_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/languages","stargazers_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/stargazers","contributors_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/contributors","subscribers_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/subscribers","subscription_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/subscription","commits_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/merges","archive_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/downloads","issues_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/labels{/name}","releases_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/releases{/id}","deployments_url":"https://api.github.com/repos/ruby-bench/ruby-bench-web/deployments","created_at":"2014-11-18T15:27:41Z","updated_at":"2016-07-06T11:17:49Z","pushed_at":"2016-07-31T13:06:13Z","git_url":"git://github.com/ruby-bench/ruby-bench-web.git","ssh_url":"git@github.com:ruby-bench/ruby-bench-web.git","clone_url":"https://github.com/ruby-bench/ruby-bench-web.git","svn_url":"https://github.com/ruby-bench/ruby-bench-web","homepage":"https://rubybench.org","size":8098,"stargazers_count":61,"watchers_count":61,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":12,"forks":27,"open_issues":12,"watchers":61,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174"},"html":{"href":"https://github.com/ruby-bench/ruby-bench-web/pull/174"},"issue":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/issues/174"},"comments":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/issues/174/comments"},"review_comments":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174/comments"},"review_comment":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/pulls/174/commits"},"statuses":{"href":"https://api.github.com/repos/ruby-bench/ruby-bench-web/statuses/2a9e1e256bd17679c1af0379774616c5cc70e1c9"}}}}
{"actor":{"display_login":"tgxworld"}}