{"action":"created","comment":{"url":"https://api.github.com/repos/rubygems/rubygems/pulls/comments/198571215","pull_request_review_id":132524363,"id":198571215,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODU3MTIxNQ==","diff_hunk":"@@ -116,4 +116,18 @@ def self.traverse_parents directory, &block\n     end\n   end\n \n+  ##\n+  # Globs for files matching +pattern+ inside of +directory+,\n+  # returning absolute paths to the matching files.\n+\n+  if RUBY_VERSION >= \"2.5\"","path":"lib/rubygems/util.rb","position":8,"original_position":8,"commit_id":"4fccfccc1e931f09785a4eb686db0585d2272c1b","original_commit_id":"4fccfccc1e931f09785a4eb686db0585d2272c1b","user":{"login":"MSP-Greg","id":15081176,"node_id":"MDQ6VXNlcjE1MDgxMTc2","avatar_url":"https://avatars3.githubusercontent.com/u/15081176?v=4","gravatar_id":"","url":"https://api.github.com/users/MSP-Greg","html_url":"https://github.com/MSP-Greg","followers_url":"https://api.github.com/users/MSP-Greg/followers","following_url":"https://api.github.com/users/MSP-Greg/following{/other_user}","gists_url":"https://api.github.com/users/MSP-Greg/gists{/gist_id}","starred_url":"https://api.github.com/users/MSP-Greg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSP-Greg/subscriptions","organizations_url":"https://api.github.com/users/MSP-Greg/orgs","repos_url":"https://api.github.com/users/MSP-Greg/repos","events_url":"https://api.github.com/users/MSP-Greg/events{/privacy}","received_events_url":"https://api.github.com/users/MSP-Greg/received_events","type":"User","site_admin":false},"body":"I suspect the cost of the condition will always be far less that the cost of reading a dir, SSD or not...","created_at":"2018-06-27T17:07:41Z","updated_at":"2018-06-27T17:07:42Z","html_url":"https://github.com/rubygems/rubygems/pull/2336#discussion_r198571215","pull_request_url":"https://api.github.com/repos/rubygems/rubygems/pulls/2336","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rubygems/rubygems/pulls/comments/198571215"},"html":{"href":"https://github.com/rubygems/rubygems/pull/2336#discussion_r198571215"},"pull_request":{"href":"https://api.github.com/repos/rubygems/rubygems/pulls/2336"}},"in_reply_to_id":198378086},"pull_request":{"url":"https://api.github.com/repos/rubygems/rubygems/pulls/2336","id":197616921,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3NjE2OTIx","html_url":"https://github.com/rubygems/rubygems/pull/2336","diff_url":"https://github.com/rubygems/rubygems/pull/2336.diff","patch_url":"https://github.com/rubygems/rubygems/pull/2336.patch","issue_url":"https://api.github.com/repos/rubygems/rubygems/issues/2336","number":2336,"state":"open","locked":false,"title":"Speed up globbing relative to given directories","user":{"login":"segiddins","id":1946610,"node_id":"MDQ6VXNlcjE5NDY2MTA=","avatar_url":"https://avatars1.githubusercontent.com/u/1946610?v=4","gravatar_id":"","url":"https://api.github.com/users/segiddins","html_url":"https://github.com/segiddins","followers_url":"https://api.github.com/users/segiddins/followers","following_url":"https://api.github.com/users/segiddins/following{/other_user}","gists_url":"https://api.github.com/users/segiddins/gists{/gist_id}","starred_url":"https://api.github.com/users/segiddins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segiddins/subscriptions","organizations_url":"https://api.github.com/users/segiddins/orgs","repos_url":"https://api.github.com/users/segiddins/repos","events_url":"https://api.github.com/users/segiddins/events{/privacy}","received_events_url":"https://api.github.com/users/segiddins/received_events","type":"User","site_admin":false},"body":"# Description:\r\n\r\nThis is picking up @tenderlove's improvements in https://github.com/rubygems/rubygems/pull/971.\r\n\r\nBenchmark:\r\n\r\n```ruby\r\nclass Hello\r\n  def self.old_find_files_from_load_path glob # :nodoc:\r\n    $LOAD_PATH.map { |load_path|\r\n      Dir[\"#{File.expand_path glob, load_path}#{Gem.suffix_pattern}\"]\r\n    }.flatten.select { |file| File.file? file.untaint }\r\n  end\r\n\r\n  def self.aaron_find_files_from_load_path glob # :nodoc:\r\n    search = \"#{glob}#{Gem.suffix_pattern}\"\r\n    $LOAD_PATH.map { |load_path|\r\n      Dir.chdir(load_path) {\r\n        Dir[search].map! { |f| File.join load_path, f }\r\n      }\r\n    }.flatten.select { |file| File.file? file.untaint }\r\n  end\r\n  \r\n  def self.new_find_files_from_load_path glob # :nodoc:\r\n    glob_with_suffixes = \"#{glob}#{Gem.suffix_pattern}\"\r\n    $LOAD_PATH.map { |load_path|\r\n      Dir.glob(glob_with_suffixes, base: load_path).map! {|f| File.join(load_path, f) }\r\n    }.flatten.select { |file| File.file? file.untaint }\r\n  end\r\nend\r\n\r\nsearch = \"minitest/*_plugin.rb\"\r\n\r\nBenchmark.ips do |x|\r\n  x.report('old') do\r\n    Hello.old_find_files_from_load_path search\r\n  end\r\n\r\n  x.report('aaron') do\r\n    Hello.aaron_find_files_from_load_path search\r\n  end\r\n  \r\n  x.report('new') do\r\n    Hello.new_find_files_from_load_path search\r\n  end\r\n  \r\n  x.compare!\r\nend\r\n```\r\n\r\nResults (on Ruby 2.5):\r\n\r\n```\r\nWarming up --------------------------------------\r\n                 old    94.000  i/100ms\r\n               aaron   297.000  i/100ms\r\n                 new   729.000  i/100ms\r\nCalculating -------------------------------------\r\n                 old    840.927  (±28.2%) i/s -      3.666k in   5.094465s\r\n               aaron      2.843k (±19.2%) i/s -     13.365k in   5.012555s\r\n                 new      7.457k (± 9.4%) i/s -     37.179k in   5.046804s\r\n\r\nComparison:\r\n                 new:     7457.4 i/s\r\n               aaron:     2842.6 i/s - 2.62x  slower\r\n                 old:      840.9 i/s - 8.87x  slower\r\n```\r\n\r\n# Tasks:\r\n\r\n- [ ] Describe the problem / feature\r\n- [ ] Write tests\r\n- [ ] Write code to solve the problem\r\n- [ ] Get code review from coworkers / friends\r\n\r\nI will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).","created_at":"2018-06-27T05:03:04Z","updated_at":"2018-06-27T17:07:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"084e7bc2ff5acd6ef7f1e8524ee58eabcf35c174","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":307374455,"node_id":"MDU6TGFiZWwzMDczNzQ0NTU=","url":"https://api.github.com/repos/rubygems/rubygems/labels/status:%20triage","name":"status: triage","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rubygems/rubygems/pulls/2336/commits","review_comments_url":"https://api.github.com/repos/rubygems/rubygems/pulls/2336/comments","review_comment_url":"https://api.github.com/repos/rubygems/rubygems/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rubygems/rubygems/issues/2336/comments","statuses_url":"https://api.github.com/repos/rubygems/rubygems/statuses/4fccfccc1e931f09785a4eb686db0585d2272c1b","head":{"label":"rubygems:segiddins/speed-up-find-files","ref":"segiddins/speed-up-find-files","sha":"4fccfccc1e931f09785a4eb686db0585d2272c1b","user":{"login":"rubygems","id":208761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODc2MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/208761?v=4","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"repo":{"id":614070,"node_id":"MDEwOlJlcG9zaXRvcnk2MTQwNzA=","name":"rubygems","full_name":"rubygems/rubygems","owner":{"login":"rubygems","id":208761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODc2MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/208761?v=4","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubygems/rubygems","description":"Library packaging and distribution for Ruby.","fork":false,"url":"https://api.github.com/repos/rubygems/rubygems","forks_url":"https://api.github.com/repos/rubygems/rubygems/forks","keys_url":"https://api.github.com/repos/rubygems/rubygems/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubygems/rubygems/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubygems/rubygems/teams","hooks_url":"https://api.github.com/repos/rubygems/rubygems/hooks","issue_events_url":"https://api.github.com/repos/rubygems/rubygems/issues/events{/number}","events_url":"https://api.github.com/repos/rubygems/rubygems/events","assignees_url":"https://api.github.com/repos/rubygems/rubygems/assignees{/user}","branches_url":"https://api.github.com/repos/rubygems/rubygems/branches{/branch}","tags_url":"https://api.github.com/repos/rubygems/rubygems/tags","blobs_url":"https://api.github.com/repos/rubygems/rubygems/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubygems/rubygems/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubygems/rubygems/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubygems/rubygems/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubygems/rubygems/statuses/{sha}","languages_url":"https://api.github.com/repos/rubygems/rubygems/languages","stargazers_url":"https://api.github.com/repos/rubygems/rubygems/stargazers","contributors_url":"https://api.github.com/repos/rubygems/rubygems/contributors","subscribers_url":"https://api.github.com/repos/rubygems/rubygems/subscribers","subscription_url":"https://api.github.com/repos/rubygems/rubygems/subscription","commits_url":"https://api.github.com/repos/rubygems/rubygems/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubygems/rubygems/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubygems/rubygems/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubygems/rubygems/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubygems/rubygems/contents/{+path}","compare_url":"https://api.github.com/repos/rubygems/rubygems/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubygems/rubygems/merges","archive_url":"https://api.github.com/repos/rubygems/rubygems/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubygems/rubygems/downloads","issues_url":"https://api.github.com/repos/rubygems/rubygems/issues{/number}","pulls_url":"https://api.github.com/repos/rubygems/rubygems/pulls{/number}","milestones_url":"https://api.github.com/repos/rubygems/rubygems/milestones{/number}","notifications_url":"https://api.github.com/repos/rubygems/rubygems/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubygems/rubygems/labels{/name}","releases_url":"https://api.github.com/repos/rubygems/rubygems/releases{/id}","deployments_url":"https://api.github.com/repos/rubygems/rubygems/deployments","created_at":"2010-04-16T19:02:44Z","updated_at":"2018-06-27T16:32:52Z","pushed_at":"2018-06-27T15:52:15Z","git_url":"git://github.com/rubygems/rubygems.git","ssh_url":"git@github.com:rubygems/rubygems.git","clone_url":"https://github.com/rubygems/rubygems.git","svn_url":"https://github.com/rubygems/rubygems","homepage":"https://rubygems.org/","size":14831,"stargazers_count":1977,"watchers_count":1977,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":984,"mirror_url":null,"archived":false,"open_issues_count":106,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":984,"open_issues":106,"watchers":1977,"default_branch":"master"}},"base":{"label":"rubygems:master","ref":"master","sha":"1923fb0603208f7a4fa2ee384f454d662e114d75","user":{"login":"rubygems","id":208761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODc2MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/208761?v=4","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"repo":{"id":614070,"node_id":"MDEwOlJlcG9zaXRvcnk2MTQwNzA=","name":"rubygems","full_name":"rubygems/rubygems","owner":{"login":"rubygems","id":208761,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODc2MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/208761?v=4","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubygems/rubygems","description":"Library packaging and distribution for Ruby.","fork":false,"url":"https://api.github.com/repos/rubygems/rubygems","forks_url":"https://api.github.com/repos/rubygems/rubygems/forks","keys_url":"https://api.github.com/repos/rubygems/rubygems/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubygems/rubygems/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubygems/rubygems/teams","hooks_url":"https://api.github.com/repos/rubygems/rubygems/hooks","issue_events_url":"https://api.github.com/repos/rubygems/rubygems/issues/events{/number}","events_url":"https://api.github.com/repos/rubygems/rubygems/events","assignees_url":"https://api.github.com/repos/rubygems/rubygems/assignees{/user}","branches_url":"https://api.github.com/repos/rubygems/rubygems/branches{/branch}","tags_url":"https://api.github.com/repos/rubygems/rubygems/tags","blobs_url":"https://api.github.com/repos/rubygems/rubygems/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubygems/rubygems/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubygems/rubygems/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubygems/rubygems/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubygems/rubygems/statuses/{sha}","languages_url":"https://api.github.com/repos/rubygems/rubygems/languages","stargazers_url":"https://api.github.com/repos/rubygems/rubygems/stargazers","contributors_url":"https://api.github.com/repos/rubygems/rubygems/contributors","subscribers_url":"https://api.github.com/repos/rubygems/rubygems/subscribers","subscription_url":"https://api.github.com/repos/rubygems/rubygems/subscription","commits_url":"https://api.github.com/repos/rubygems/rubygems/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubygems/rubygems/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubygems/rubygems/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubygems/rubygems/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubygems/rubygems/contents/{+path}","compare_url":"https://api.github.com/repos/rubygems/rubygems/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubygems/rubygems/merges","archive_url":"https://api.github.com/repos/rubygems/rubygems/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubygems/rubygems/downloads","issues_url":"https://api.github.com/repos/rubygems/rubygems/issues{/number}","pulls_url":"https://api.github.com/repos/rubygems/rubygems/pulls{/number}","milestones_url":"https://api.github.com/repos/rubygems/rubygems/milestones{/number}","notifications_url":"https://api.github.com/repos/rubygems/rubygems/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubygems/rubygems/labels{/name}","releases_url":"https://api.github.com/repos/rubygems/rubygems/releases{/id}","deployments_url":"https://api.github.com/repos/rubygems/rubygems/deployments","created_at":"2010-04-16T19:02:44Z","updated_at":"2018-06-27T16:32:52Z","pushed_at":"2018-06-27T15:52:15Z","git_url":"git://github.com/rubygems/rubygems.git","ssh_url":"git@github.com:rubygems/rubygems.git","clone_url":"https://github.com/rubygems/rubygems.git","svn_url":"https://github.com/rubygems/rubygems","homepage":"https://rubygems.org/","size":14831,"stargazers_count":1977,"watchers_count":1977,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":984,"mirror_url":null,"archived":false,"open_issues_count":106,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":984,"open_issues":106,"watchers":1977,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubygems/rubygems/pulls/2336"},"html":{"href":"https://github.com/rubygems/rubygems/pull/2336"},"issue":{"href":"https://api.github.com/repos/rubygems/rubygems/issues/2336"},"comments":{"href":"https://api.github.com/repos/rubygems/rubygems/issues/2336/comments"},"review_comments":{"href":"https://api.github.com/repos/rubygems/rubygems/pulls/2336/comments"},"review_comment":{"href":"https://api.github.com/repos/rubygems/rubygems/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rubygems/rubygems/pulls/2336/commits"},"statuses":{"href":"https://api.github.com/repos/rubygems/rubygems/statuses/4fccfccc1e931f09785a4eb686db0585d2272c1b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"MSP-Greg"}}