{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/1905","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/1905/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/1905/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/1905/events","html_url":"https://github.com/webpack/webpack/issues/1905","id":127423364,"number":1905,"title":"Scaling to large codebases","user":{"login":"unindented","id":69485,"avatar_url":"https://avatars.githubusercontent.com/u/69485?v=3","gravatar_id":"","url":"https://api.github.com/users/unindented","html_url":"https://github.com/unindented","followers_url":"https://api.github.com/users/unindented/followers","following_url":"https://api.github.com/users/unindented/following{/other_user}","gists_url":"https://api.github.com/users/unindented/gists{/gist_id}","starred_url":"https://api.github.com/users/unindented/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unindented/subscriptions","organizations_url":"https://api.github.com/users/unindented/orgs","repos_url":"https://api.github.com/users/unindented/repos","events_url":"https://api.github.com/users/unindented/events{/privacy}","received_events_url":"https://api.github.com/users/unindented/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/webpack/webpack/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2016-01-19T11:17:45Z","updated_at":"2016-02-17T00:44:57Z","closed_at":null,"body":"I have a codebase with ~2000 JS files (no loaders), ~500 CSS files (`style!css!postcss!`), and ~500 Mustache templates (`mustache!`). The build time on a beefy box is ~5min. What are my options to decrease this time?\r\n\r\nThe build is CPU-bound as far as I can tell. Webpack runs single-threaded, but I can't think of a way around that.\r\n\r\nThe thing is, on a certain build, only a handful of files have changed from the previous one. When webpack is in `watch` mode, it can rebuild super quickly (I'm guessing because it only builds the parts that are affected by the change). Couldn't the same strategy be applied to normal builds?\r\n\r\n@sokra @bebraw Does anything in Webpack 2 address this? If it doesn't, could you give me some pointers on persisting the dependency tree across builds to achieve fast builds? Or maybe some other ideas that you have?"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/184943541","html_url":"https://github.com/webpack/webpack/issues/1905#issuecomment-184943541","issue_url":"https://api.github.com/repos/webpack/webpack/issues/1905","id":184943541,"user":{"login":"larryhe","id":52333,"avatar_url":"https://avatars.githubusercontent.com/u/52333?v=3","gravatar_id":"","url":"https://api.github.com/users/larryhe","html_url":"https://github.com/larryhe","followers_url":"https://api.github.com/users/larryhe/followers","following_url":"https://api.github.com/users/larryhe/following{/other_user}","gists_url":"https://api.github.com/users/larryhe/gists{/gist_id}","starred_url":"https://api.github.com/users/larryhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larryhe/subscriptions","organizations_url":"https://api.github.com/users/larryhe/orgs","repos_url":"https://api.github.com/users/larryhe/repos","events_url":"https://api.github.com/users/larryhe/events{/privacy}","received_events_url":"https://api.github.com/users/larryhe/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T00:44:57Z","updated_at":"2016-02-17T00:44:57Z","body":"I just profiled and debugged webpack and found most of time spent on incrementation build (over 93%) is in apply function of RemoveParentModulesPlugin.js as following:  Could @sokra share us some clues to improve it?  Thanks for your time. \r\n```\r\nRemoveParentModulesPlugin.prototype.apply = function(compiler) {\r\n\tcompiler.plugin(\"compilation\", function(compilation) {\r\n\t\tcompilation.plugin([\"optimize-chunks\", \"optimize-extracted-chunks\"], function(chunks) {\r\n\t\t\tchunks.forEach(function(chunk) {\r\n\t\t\t\tchunk.modules.slice().forEach(function(module) {\r\n\t\t\t\t\tif(chunk.entry) return;\r\n\t\t\t\t\tvar parentChunksWithModule = allHaveModule(chunk.parents, module);\r\n\t\t\t\t\tif(parentChunksWithModule) {\r\n\t\t\t\t\t\tmodule.rewriteChunkInReasons(chunk, parentChunksWithModule);\r\n\t\t\t\t\t\tchunk.removeModule(module);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\t});\r\n};\r\n```"}}