{"action":"opened","issue":{"url":"https://api.github.com/repos/JukkaL/mypy/issues/932","labels_url":"https://api.github.com/repos/JukkaL/mypy/issues/932/labels{/name}","comments_url":"https://api.github.com/repos/JukkaL/mypy/issues/932/comments","events_url":"https://api.github.com/repos/JukkaL/mypy/issues/932/events","html_url":"https://github.com/JukkaL/mypy/issues/932","id":111551259,"number":932,"title":"Faster, incremental type checking","user":{"login":"JukkaL","id":1107911,"avatar_url":"https://avatars.githubusercontent.com/u/1107911?v=3","gravatar_id":"","url":"https://api.github.com/users/JukkaL","html_url":"https://github.com/JukkaL","followers_url":"https://api.github.com/users/JukkaL/followers","following_url":"https://api.github.com/users/JukkaL/following{/other_user}","gists_url":"https://api.github.com/users/JukkaL/gists{/gist_id}","starred_url":"https://api.github.com/users/JukkaL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JukkaL/subscriptions","organizations_url":"https://api.github.com/users/JukkaL/orgs","repos_url":"https://api.github.com/users/JukkaL/repos","events_url":"https://api.github.com/users/JukkaL/events{/privacy}","received_events_url":"https://api.github.com/users/JukkaL/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JukkaL/mypy/labels/enhancement%20proposal","name":"enhancement proposal","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-15T06:02:50Z","updated_at":"2015-10-15T06:02:50Z","closed_at":null,"body":"Mypy should cache type checking results from previous runs to speed up subsequent runs which only contain small code changes. Between two successive runs the vast majority of a code in a large project typically stays untouched, so we could save a lot of work.\r\n\r\nI've started doing some very early prototyping. This is probably quite a lot of work and won't happen very soon, but this is a critical feature for larger projects (with more than 100k LOC, say).\r\n\r\nSome random ideas I currently have:\r\n\r\n* Generate a JSON file for each type checked module that contains roughly the same information as a stub file for the module would have (i.e., function signatures, classes, module level variables -- but no function bodies) but in a format that maps very directly to mypy ASTs.\r\n* If a module and it's dependencies haven't changed since the last run, use the JSON file to represent the module and don't parse or type check the module at all.\r\n\r\nIt's not obvious how much this could help, but some back of the napkin math says that we might get, say, 10-20x the type checking performance in cases where almost everything can be cached from previous runs.\r\n\r\nLarge module dependency cycles are one scenario where this might not be too helpful. Maybe we can figure out a way to break these dependency cycles somehow and to avoid always having to fully process every module in the cycle if any of them changes."}}