{"action":"created","comment":{"url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments/205932566","pull_request_review_id":141307134,"id":205932566,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTkzMjU2Ng==","diff_hunk":"@@ -53,9 +53,9 @@ def emit_compile(\n             fail(\"compile does not accept deps in bootstrap mode\")\n         return _bootstrap_compile(go, sources, out_lib, gc_goopts)\n \n-    inputs = (sources + [go.package_list] +\n-              [archive.data.file for archive in archives] +\n-              go.sdk_tools + go.stdlib.files)\n+    inputs = sets.union(sources, [go.package_list],","path":"go/private/actions/compile.bzl","position":7,"original_position":7,"commit_id":"aa729c246ac482365086f41b4126053cf0c12d24","original_commit_id":"aa729c246ac482365086f41b4126053cf0c12d24","user":{"login":"ash2k","id":126021,"node_id":"MDQ6VXNlcjEyNjAyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/126021?v=4","gravatar_id":"","url":"https://api.github.com/users/ash2k","html_url":"https://github.com/ash2k","followers_url":"https://api.github.com/users/ash2k/followers","following_url":"https://api.github.com/users/ash2k/following{/other_user}","gists_url":"https://api.github.com/users/ash2k/gists{/gist_id}","starred_url":"https://api.github.com/users/ash2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ash2k/subscriptions","organizations_url":"https://api.github.com/users/ash2k/orgs","repos_url":"https://api.github.com/users/ash2k/repos","events_url":"https://api.github.com/users/ash2k/events{/privacy}","received_events_url":"https://api.github.com/users/ash2k/received_events","type":"User","site_admin":false},"body":"It is totally possible that my understanding is incorrect, but I believe that there are these benefits of using a depset in such a situation:\r\n1. Memory savings - list is not concatenated when the rule is executed and hence the memory is not allocated to hold it. Instead, depset is just holding references to parts (lists/dpsets).\r\n2. Execution time savings - I assume that constructing a depset is cheap, faster than list concatenation.\r\n\r\nEventually, of course, depset needs to be expanded into a (deduplicated) list and that's when the price is paid - both for deduplication and for memory allocation. However, that price is only paid if that action needs to be executed and never otherwise. And most of the time many actions do not need to run - caching or the output is not required. That is why I believe it is much better to use depsets - memory/cpu cost of analysis (or loading? not sure) phase is reduced and cost is postponed to the execution phase, but only for those actions where it needs to be paid (i.e. where the output is needed).\r\n\r\nI may be operating under a wrong assumption here, but I don't see how __constructing__ a depset can be expensive - it would not make any sense, I think. [Performance](https://docs.bazel.build/versions/master/skylark/depsets.html#performance) section does not say it directly, but I read it as if it says that `to_list()` is expensive, not construction of a depset.","created_at":"2018-07-28T04:33:25Z","updated_at":"2018-07-28T04:33:25Z","html_url":"https://github.com/bazelbuild/rules_go/pull/1610#discussion_r205932566","pull_request_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments/205932566"},"html":{"href":"https://github.com/bazelbuild/rules_go/pull/1610#discussion_r205932566"},"pull_request":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610"}},"in_reply_to_id":205811872},"pull_request":{"url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610","id":204379165,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0Mzc5MTY1","html_url":"https://github.com/bazelbuild/rules_go/pull/1610","diff_url":"https://github.com/bazelbuild/rules_go/pull/1610.diff","patch_url":"https://github.com/bazelbuild/rules_go/pull/1610.patch","issue_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/1610","number":1610,"state":"open","locked":false,"title":"Optimize args and inputs construction","user":{"login":"ash2k","id":126021,"node_id":"MDQ6VXNlcjEyNjAyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/126021?v=4","gravatar_id":"","url":"https://api.github.com/users/ash2k","html_url":"https://github.com/ash2k","followers_url":"https://api.github.com/users/ash2k/followers","following_url":"https://api.github.com/users/ash2k/following{/other_user}","gists_url":"https://api.github.com/users/ash2k/gists{/gist_id}","starred_url":"https://api.github.com/users/ash2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ash2k/subscriptions","organizations_url":"https://api.github.com/users/ash2k/orgs","repos_url":"https://api.github.com/users/ash2k/repos","events_url":"https://api.github.com/users/ash2k/events{/privacy}","received_events_url":"https://api.github.com/users/ash2k/received_events","type":"User","site_admin":false},"body":"Applied advice from https://docs.bazel.build/versions/master/skylark/performance.html to some of the files. WDYT?","created_at":"2018-07-27T09:34:29Z","updated_at":"2018-07-28T04:33:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f046b77a1d0ddc6f1555af1b04d742e17997d738","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ianthehat","id":858832,"node_id":"MDQ6VXNlcjg1ODgzMg==","avatar_url":"https://avatars0.githubusercontent.com/u/858832?v=4","gravatar_id":"","url":"https://api.github.com/users/ianthehat","html_url":"https://github.com/ianthehat","followers_url":"https://api.github.com/users/ianthehat/followers","following_url":"https://api.github.com/users/ianthehat/following{/other_user}","gists_url":"https://api.github.com/users/ianthehat/gists{/gist_id}","starred_url":"https://api.github.com/users/ianthehat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianthehat/subscriptions","organizations_url":"https://api.github.com/users/ianthehat/orgs","repos_url":"https://api.github.com/users/ianthehat/repos","events_url":"https://api.github.com/users/ianthehat/events{/privacy}","received_events_url":"https://api.github.com/users/ianthehat/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":342134177,"node_id":"MDU6TGFiZWwzNDIxMzQxNzc=","url":"https://api.github.com/repos/bazelbuild/rules_go/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610/commits","review_comments_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610/comments","review_comment_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/1610/comments","statuses_url":"https://api.github.com/repos/bazelbuild/rules_go/statuses/aa729c246ac482365086f41b4126053cf0c12d24","head":{"label":"atlassian:optimize_args","ref":"optimize_args","sha":"aa729c246ac482365086f41b4126053cf0c12d24","user":{"login":"atlassian","id":168166,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2ODE2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/168166?v=4","gravatar_id":"","url":"https://api.github.com/users/atlassian","html_url":"https://github.com/atlassian","followers_url":"https://api.github.com/users/atlassian/followers","following_url":"https://api.github.com/users/atlassian/following{/other_user}","gists_url":"https://api.github.com/users/atlassian/gists{/gist_id}","starred_url":"https://api.github.com/users/atlassian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlassian/subscriptions","organizations_url":"https://api.github.com/users/atlassian/orgs","repos_url":"https://api.github.com/users/atlassian/repos","events_url":"https://api.github.com/users/atlassian/events{/privacy}","received_events_url":"https://api.github.com/users/atlassian/received_events","type":"Organization","site_admin":false},"repo":{"id":142282409,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIyODI0MDk=","name":"rules_go","full_name":"atlassian/rules_go","owner":{"login":"atlassian","id":168166,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2ODE2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/168166?v=4","gravatar_id":"","url":"https://api.github.com/users/atlassian","html_url":"https://github.com/atlassian","followers_url":"https://api.github.com/users/atlassian/followers","following_url":"https://api.github.com/users/atlassian/following{/other_user}","gists_url":"https://api.github.com/users/atlassian/gists{/gist_id}","starred_url":"https://api.github.com/users/atlassian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlassian/subscriptions","organizations_url":"https://api.github.com/users/atlassian/orgs","repos_url":"https://api.github.com/users/atlassian/repos","events_url":"https://api.github.com/users/atlassian/events{/privacy}","received_events_url":"https://api.github.com/users/atlassian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atlassian/rules_go","description":"Go rules for Bazel","fork":true,"url":"https://api.github.com/repos/atlassian/rules_go","forks_url":"https://api.github.com/repos/atlassian/rules_go/forks","keys_url":"https://api.github.com/repos/atlassian/rules_go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atlassian/rules_go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atlassian/rules_go/teams","hooks_url":"https://api.github.com/repos/atlassian/rules_go/hooks","issue_events_url":"https://api.github.com/repos/atlassian/rules_go/issues/events{/number}","events_url":"https://api.github.com/repos/atlassian/rules_go/events","assignees_url":"https://api.github.com/repos/atlassian/rules_go/assignees{/user}","branches_url":"https://api.github.com/repos/atlassian/rules_go/branches{/branch}","tags_url":"https://api.github.com/repos/atlassian/rules_go/tags","blobs_url":"https://api.github.com/repos/atlassian/rules_go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atlassian/rules_go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atlassian/rules_go/git/refs{/sha}","trees_url":"https://api.github.com/repos/atlassian/rules_go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atlassian/rules_go/statuses/{sha}","languages_url":"https://api.github.com/repos/atlassian/rules_go/languages","stargazers_url":"https://api.github.com/repos/atlassian/rules_go/stargazers","contributors_url":"https://api.github.com/repos/atlassian/rules_go/contributors","subscribers_url":"https://api.github.com/repos/atlassian/rules_go/subscribers","subscription_url":"https://api.github.com/repos/atlassian/rules_go/subscription","commits_url":"https://api.github.com/repos/atlassian/rules_go/commits{/sha}","git_commits_url":"https://api.github.com/repos/atlassian/rules_go/git/commits{/sha}","comments_url":"https://api.github.com/repos/atlassian/rules_go/comments{/number}","issue_comment_url":"https://api.github.com/repos/atlassian/rules_go/issues/comments{/number}","contents_url":"https://api.github.com/repos/atlassian/rules_go/contents/{+path}","compare_url":"https://api.github.com/repos/atlassian/rules_go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atlassian/rules_go/merges","archive_url":"https://api.github.com/repos/atlassian/rules_go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atlassian/rules_go/downloads","issues_url":"https://api.github.com/repos/atlassian/rules_go/issues{/number}","pulls_url":"https://api.github.com/repos/atlassian/rules_go/pulls{/number}","milestones_url":"https://api.github.com/repos/atlassian/rules_go/milestones{/number}","notifications_url":"https://api.github.com/repos/atlassian/rules_go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atlassian/rules_go/labels{/name}","releases_url":"https://api.github.com/repos/atlassian/rules_go/releases{/id}","deployments_url":"https://api.github.com/repos/atlassian/rules_go/deployments","created_at":"2018-07-25T10:05:23Z","updated_at":"2018-07-25T10:05:26Z","pushed_at":"2018-07-27T09:33:21Z","git_url":"git://github.com/atlassian/rules_go.git","ssh_url":"git@github.com:atlassian/rules_go.git","clone_url":"https://github.com/atlassian/rules_go.git","svn_url":"https://github.com/atlassian/rules_go","homepage":null,"size":2813,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bazelbuild:master","ref":"master","sha":"24c4ae8023aa8d92d3b67a4fd968f49b99225230","user":{"login":"bazelbuild","id":11684617,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjg0NjE3","avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"repo":{"id":53954979,"node_id":"MDEwOlJlcG9zaXRvcnk1Mzk1NDk3OQ==","name":"rules_go","full_name":"bazelbuild/rules_go","owner":{"login":"bazelbuild","id":11684617,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjg0NjE3","avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bazelbuild/rules_go","description":"Go rules for Bazel","fork":false,"url":"https://api.github.com/repos/bazelbuild/rules_go","forks_url":"https://api.github.com/repos/bazelbuild/rules_go/forks","keys_url":"https://api.github.com/repos/bazelbuild/rules_go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazelbuild/rules_go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazelbuild/rules_go/teams","hooks_url":"https://api.github.com/repos/bazelbuild/rules_go/hooks","issue_events_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/events{/number}","events_url":"https://api.github.com/repos/bazelbuild/rules_go/events","assignees_url":"https://api.github.com/repos/bazelbuild/rules_go/assignees{/user}","branches_url":"https://api.github.com/repos/bazelbuild/rules_go/branches{/branch}","tags_url":"https://api.github.com/repos/bazelbuild/rules_go/tags","blobs_url":"https://api.github.com/repos/bazelbuild/rules_go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazelbuild/rules_go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazelbuild/rules_go/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazelbuild/rules_go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazelbuild/rules_go/statuses/{sha}","languages_url":"https://api.github.com/repos/bazelbuild/rules_go/languages","stargazers_url":"https://api.github.com/repos/bazelbuild/rules_go/stargazers","contributors_url":"https://api.github.com/repos/bazelbuild/rules_go/contributors","subscribers_url":"https://api.github.com/repos/bazelbuild/rules_go/subscribers","subscription_url":"https://api.github.com/repos/bazelbuild/rules_go/subscription","commits_url":"https://api.github.com/repos/bazelbuild/rules_go/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazelbuild/rules_go/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazelbuild/rules_go/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazelbuild/rules_go/contents/{+path}","compare_url":"https://api.github.com/repos/bazelbuild/rules_go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazelbuild/rules_go/merges","archive_url":"https://api.github.com/repos/bazelbuild/rules_go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazelbuild/rules_go/downloads","issues_url":"https://api.github.com/repos/bazelbuild/rules_go/issues{/number}","pulls_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls{/number}","milestones_url":"https://api.github.com/repos/bazelbuild/rules_go/milestones{/number}","notifications_url":"https://api.github.com/repos/bazelbuild/rules_go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazelbuild/rules_go/labels{/name}","releases_url":"https://api.github.com/repos/bazelbuild/rules_go/releases{/id}","deployments_url":"https://api.github.com/repos/bazelbuild/rules_go/deployments","created_at":"2016-03-15T15:15:14Z","updated_at":"2018-07-27T19:05:17Z","pushed_at":"2018-07-27T20:22:47Z","git_url":"git://github.com/bazelbuild/rules_go.git","ssh_url":"git@github.com:bazelbuild/rules_go.git","clone_url":"https://github.com/bazelbuild/rules_go.git","svn_url":"https://github.com/bazelbuild/rules_go","homepage":null,"size":2813,"stargazers_count":311,"watchers_count":311,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":195,"mirror_url":null,"archived":false,"open_issues_count":102,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":195,"open_issues":102,"watchers":311,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610"},"html":{"href":"https://github.com/bazelbuild/rules_go/pull/1610"},"issue":{"href":"https://api.github.com/repos/bazelbuild/rules_go/issues/1610"},"comments":{"href":"https://api.github.com/repos/bazelbuild/rules_go/issues/1610/comments"},"review_comments":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610/comments"},"review_comment":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1610/commits"},"statuses":{"href":"https://api.github.com/repos/bazelbuild/rules_go/statuses/aa729c246ac482365086f41b4126053cf0c12d24"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ash2k"}}