{"action":"created","comment":{"url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/comments/91573638","pull_request_review_id":12083668,"id":91573638,"diff_hunk":"@@ -199,7 +199,11 @@ function hash(src, filePath) {\n }\n \n function symlinkOrCopyFromCache(entry, dest, relativePath) {\n-  mkdirp.sync(path.dirname(entry.outputFile));\n-\n-  symlinkOrCopySync(entry.cacheFile, dest + '/' + relativePath);\n+  try {","path":"index.js","position":7,"original_position":7,"commit_id":"e9d68a3c03c9bbdd67b9160b08c99cf25bfa980d","original_commit_id":"e9d68a3c03c9bbdd67b9160b08c99cf25bfa980d","user":{"login":"rwjblue","id":12637,"avatar_url":"https://avatars.githubusercontent.com/u/12637?v=3","gravatar_id":"","url":"https://api.github.com/users/rwjblue","html_url":"https://github.com/rwjblue","followers_url":"https://api.github.com/users/rwjblue/followers","following_url":"https://api.github.com/users/rwjblue/following{/other_user}","gists_url":"https://api.github.com/users/rwjblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rwjblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwjblue/subscriptions","organizations_url":"https://api.github.com/users/rwjblue/orgs","repos_url":"https://api.github.com/users/rwjblue/repos","events_url":"https://api.github.com/users/rwjblue/events{/privacy}","received_events_url":"https://api.github.com/users/rwjblue/received_events","type":"User","site_admin":false},"body":"Ya, we definitely could if you'd prefer that approach. We should co-opt that for broccoli-persistent-filter too though (I took inspiration here from that).","created_at":"2016-12-08T18:21:03Z","updated_at":"2016-12-08T18:21:03Z","html_url":"https://github.com/broccolijs/broccoli-filter/pull/44#discussion_r91573638","pull_request_url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/comments/91573638"},"html":{"href":"https://github.com/broccolijs/broccoli-filter/pull/44#discussion_r91573638"},"pull_request":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44","id":97166697,"html_url":"https://github.com/broccolijs/broccoli-filter/pull/44","diff_url":"https://github.com/broccolijs/broccoli-filter/pull/44.diff","patch_url":"https://github.com/broccolijs/broccoli-filter/pull/44.patch","issue_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/44","number":44,"state":"open","locked":false,"title":"Avoid calling `mkdirp` for every file copied from cache.","user":{"login":"rwjblue","id":12637,"avatar_url":"https://avatars.githubusercontent.com/u/12637?v=3","gravatar_id":"","url":"https://api.github.com/users/rwjblue","html_url":"https://github.com/rwjblue","followers_url":"https://api.github.com/users/rwjblue/followers","following_url":"https://api.github.com/users/rwjblue/following{/other_user}","gists_url":"https://api.github.com/users/rwjblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rwjblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwjblue/subscriptions","organizations_url":"https://api.github.com/users/rwjblue/orgs","repos_url":"https://api.github.com/users/rwjblue/repos","events_url":"https://api.github.com/users/rwjblue/events{/privacy}","received_events_url":"https://api.github.com/users/rwjblue/received_events","type":"User","site_admin":false},"body":"This updates `symlinkOrCopyFromCache` to avoid eagerly calling `mkdirp.sync`, and now only calls it if an error occurs.\r\n\r\nWe want to avoid `mkdirp` if possible, since it does extra I/O for every copy from cache operation when most likely the directory is already created (this is essentially assuming that the majority of directories have at least 2 files in them).\r\n\r\nOne way to visualize the cost of calling `mkdirp` eagerly is to look at its default implementation (pseudo code):\r\n\r\n```js\r\nfunction sync(dirPath) {\r\n  try {\r\n    fs.mkdirSync(dirPath);\r\n  } catch(err0) {\r\n    if (err0.code === 'ENOENT') {\r\n      sync(path.dirname(dirPath)\r\n      sync(dirPath);\r\n    }\r\n    var stat;\r\n    try {\r\n      stat = fs.statSync(dirPath);\r\n    } catch(err1) {\r\n      throw err0;\r\n    }\r\n\r\n    if (!stat.isDirectory()) { throw err0; }\r\n  }\r\n}\r\n```","created_at":"2016-12-08T17:33:50Z","updated_at":"2016-12-08T18:21:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06e17aa2b9a85414743288baaf3737982d407c80","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44/commits","review_comments_url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44/comments","review_comment_url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/44/comments","statuses_url":"https://api.github.com/repos/broccolijs/broccoli-filter/statuses/e9d68a3c03c9bbdd67b9160b08c99cf25bfa980d","head":{"label":"broccolijs:avoid-mkdirp","ref":"avoid-mkdirp","sha":"e9d68a3c03c9bbdd67b9160b08c99cf25bfa980d","user":{"login":"broccolijs","id":6686448,"avatar_url":"https://avatars.githubusercontent.com/u/6686448?v=3","gravatar_id":"","url":"https://api.github.com/users/broccolijs","html_url":"https://github.com/broccolijs","followers_url":"https://api.github.com/users/broccolijs/followers","following_url":"https://api.github.com/users/broccolijs/following{/other_user}","gists_url":"https://api.github.com/users/broccolijs/gists{/gist_id}","starred_url":"https://api.github.com/users/broccolijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broccolijs/subscriptions","organizations_url":"https://api.github.com/users/broccolijs/orgs","repos_url":"https://api.github.com/users/broccolijs/repos","events_url":"https://api.github.com/users/broccolijs/events{/privacy}","received_events_url":"https://api.github.com/users/broccolijs/received_events","type":"Organization","site_admin":false},"repo":{"id":16712769,"name":"broccoli-filter","full_name":"broccolijs/broccoli-filter","owner":{"login":"broccolijs","id":6686448,"avatar_url":"https://avatars.githubusercontent.com/u/6686448?v=3","gravatar_id":"","url":"https://api.github.com/users/broccolijs","html_url":"https://github.com/broccolijs","followers_url":"https://api.github.com/users/broccolijs/followers","following_url":"https://api.github.com/users/broccolijs/following{/other_user}","gists_url":"https://api.github.com/users/broccolijs/gists{/gist_id}","starred_url":"https://api.github.com/users/broccolijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broccolijs/subscriptions","organizations_url":"https://api.github.com/users/broccolijs/orgs","repos_url":"https://api.github.com/users/broccolijs/repos","events_url":"https://api.github.com/users/broccolijs/events{/privacy}","received_events_url":"https://api.github.com/users/broccolijs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broccolijs/broccoli-filter","description":"Helper base class for Broccoli plugins that map input files into output files one-to-one","fork":false,"url":"https://api.github.com/repos/broccolijs/broccoli-filter","forks_url":"https://api.github.com/repos/broccolijs/broccoli-filter/forks","keys_url":"https://api.github.com/repos/broccolijs/broccoli-filter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broccolijs/broccoli-filter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broccolijs/broccoli-filter/teams","hooks_url":"https://api.github.com/repos/broccolijs/broccoli-filter/hooks","issue_events_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/events{/number}","events_url":"https://api.github.com/repos/broccolijs/broccoli-filter/events","assignees_url":"https://api.github.com/repos/broccolijs/broccoli-filter/assignees{/user}","branches_url":"https://api.github.com/repos/broccolijs/broccoli-filter/branches{/branch}","tags_url":"https://api.github.com/repos/broccolijs/broccoli-filter/tags","blobs_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/refs{/sha}","trees_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broccolijs/broccoli-filter/statuses/{sha}","languages_url":"https://api.github.com/repos/broccolijs/broccoli-filter/languages","stargazers_url":"https://api.github.com/repos/broccolijs/broccoli-filter/stargazers","contributors_url":"https://api.github.com/repos/broccolijs/broccoli-filter/contributors","subscribers_url":"https://api.github.com/repos/broccolijs/broccoli-filter/subscribers","subscription_url":"https://api.github.com/repos/broccolijs/broccoli-filter/subscription","commits_url":"https://api.github.com/repos/broccolijs/broccoli-filter/commits{/sha}","git_commits_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/commits{/sha}","comments_url":"https://api.github.com/repos/broccolijs/broccoli-filter/comments{/number}","issue_comment_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/comments{/number}","contents_url":"https://api.github.com/repos/broccolijs/broccoli-filter/contents/{+path}","compare_url":"https://api.github.com/repos/broccolijs/broccoli-filter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broccolijs/broccoli-filter/merges","archive_url":"https://api.github.com/repos/broccolijs/broccoli-filter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broccolijs/broccoli-filter/downloads","issues_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues{/number}","pulls_url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls{/number}","milestones_url":"https://api.github.com/repos/broccolijs/broccoli-filter/milestones{/number}","notifications_url":"https://api.github.com/repos/broccolijs/broccoli-filter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broccolijs/broccoli-filter/labels{/name}","releases_url":"https://api.github.com/repos/broccolijs/broccoli-filter/releases{/id}","deployments_url":"https://api.github.com/repos/broccolijs/broccoli-filter/deployments","created_at":"2014-02-10T23:17:40Z","updated_at":"2016-03-10T14:17:21Z","pushed_at":"2016-12-08T17:33:50Z","git_url":"git://github.com/broccolijs/broccoli-filter.git","ssh_url":"git@github.com:broccolijs/broccoli-filter.git","clone_url":"https://github.com/broccolijs/broccoli-filter.git","svn_url":"https://github.com/broccolijs/broccoli-filter","homepage":"","size":171,"stargazers_count":13,"watchers_count":13,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":7,"forks":28,"open_issues":7,"watchers":13,"default_branch":"master"}},"base":{"label":"broccolijs:master","ref":"master","sha":"40382b1bf37d3969e84736923c1beceb2122bb4f","user":{"login":"broccolijs","id":6686448,"avatar_url":"https://avatars.githubusercontent.com/u/6686448?v=3","gravatar_id":"","url":"https://api.github.com/users/broccolijs","html_url":"https://github.com/broccolijs","followers_url":"https://api.github.com/users/broccolijs/followers","following_url":"https://api.github.com/users/broccolijs/following{/other_user}","gists_url":"https://api.github.com/users/broccolijs/gists{/gist_id}","starred_url":"https://api.github.com/users/broccolijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broccolijs/subscriptions","organizations_url":"https://api.github.com/users/broccolijs/orgs","repos_url":"https://api.github.com/users/broccolijs/repos","events_url":"https://api.github.com/users/broccolijs/events{/privacy}","received_events_url":"https://api.github.com/users/broccolijs/received_events","type":"Organization","site_admin":false},"repo":{"id":16712769,"name":"broccoli-filter","full_name":"broccolijs/broccoli-filter","owner":{"login":"broccolijs","id":6686448,"avatar_url":"https://avatars.githubusercontent.com/u/6686448?v=3","gravatar_id":"","url":"https://api.github.com/users/broccolijs","html_url":"https://github.com/broccolijs","followers_url":"https://api.github.com/users/broccolijs/followers","following_url":"https://api.github.com/users/broccolijs/following{/other_user}","gists_url":"https://api.github.com/users/broccolijs/gists{/gist_id}","starred_url":"https://api.github.com/users/broccolijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broccolijs/subscriptions","organizations_url":"https://api.github.com/users/broccolijs/orgs","repos_url":"https://api.github.com/users/broccolijs/repos","events_url":"https://api.github.com/users/broccolijs/events{/privacy}","received_events_url":"https://api.github.com/users/broccolijs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broccolijs/broccoli-filter","description":"Helper base class for Broccoli plugins that map input files into output files one-to-one","fork":false,"url":"https://api.github.com/repos/broccolijs/broccoli-filter","forks_url":"https://api.github.com/repos/broccolijs/broccoli-filter/forks","keys_url":"https://api.github.com/repos/broccolijs/broccoli-filter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broccolijs/broccoli-filter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broccolijs/broccoli-filter/teams","hooks_url":"https://api.github.com/repos/broccolijs/broccoli-filter/hooks","issue_events_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/events{/number}","events_url":"https://api.github.com/repos/broccolijs/broccoli-filter/events","assignees_url":"https://api.github.com/repos/broccolijs/broccoli-filter/assignees{/user}","branches_url":"https://api.github.com/repos/broccolijs/broccoli-filter/branches{/branch}","tags_url":"https://api.github.com/repos/broccolijs/broccoli-filter/tags","blobs_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/refs{/sha}","trees_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broccolijs/broccoli-filter/statuses/{sha}","languages_url":"https://api.github.com/repos/broccolijs/broccoli-filter/languages","stargazers_url":"https://api.github.com/repos/broccolijs/broccoli-filter/stargazers","contributors_url":"https://api.github.com/repos/broccolijs/broccoli-filter/contributors","subscribers_url":"https://api.github.com/repos/broccolijs/broccoli-filter/subscribers","subscription_url":"https://api.github.com/repos/broccolijs/broccoli-filter/subscription","commits_url":"https://api.github.com/repos/broccolijs/broccoli-filter/commits{/sha}","git_commits_url":"https://api.github.com/repos/broccolijs/broccoli-filter/git/commits{/sha}","comments_url":"https://api.github.com/repos/broccolijs/broccoli-filter/comments{/number}","issue_comment_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/comments{/number}","contents_url":"https://api.github.com/repos/broccolijs/broccoli-filter/contents/{+path}","compare_url":"https://api.github.com/repos/broccolijs/broccoli-filter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broccolijs/broccoli-filter/merges","archive_url":"https://api.github.com/repos/broccolijs/broccoli-filter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broccolijs/broccoli-filter/downloads","issues_url":"https://api.github.com/repos/broccolijs/broccoli-filter/issues{/number}","pulls_url":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls{/number}","milestones_url":"https://api.github.com/repos/broccolijs/broccoli-filter/milestones{/number}","notifications_url":"https://api.github.com/repos/broccolijs/broccoli-filter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broccolijs/broccoli-filter/labels{/name}","releases_url":"https://api.github.com/repos/broccolijs/broccoli-filter/releases{/id}","deployments_url":"https://api.github.com/repos/broccolijs/broccoli-filter/deployments","created_at":"2014-02-10T23:17:40Z","updated_at":"2016-03-10T14:17:21Z","pushed_at":"2016-12-08T17:33:50Z","git_url":"git://github.com/broccolijs/broccoli-filter.git","ssh_url":"git@github.com:broccolijs/broccoli-filter.git","clone_url":"https://github.com/broccolijs/broccoli-filter.git","svn_url":"https://github.com/broccolijs/broccoli-filter","homepage":"","size":171,"stargazers_count":13,"watchers_count":13,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":7,"forks":28,"open_issues":7,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44"},"html":{"href":"https://github.com/broccolijs/broccoli-filter/pull/44"},"issue":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/44"},"comments":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/broccolijs/broccoli-filter/statuses/e9d68a3c03c9bbdd67b9160b08c99cf25bfa980d"}}}}
{"actor":{"display_login":"rwjblue"}}