{"action":"opened","number":452,"pull_request":{"url":"https://api.github.com/repos/mobxjs/mobx/pulls/452","id":79635427,"html_url":"https://github.com/mobxjs/mobx/pull/452","diff_url":"https://github.com/mobxjs/mobx/pull/452.diff","patch_url":"https://github.com/mobxjs/mobx/pull/452.patch","issue_url":"https://api.github.com/repos/mobxjs/mobx/issues/452","number":452,"state":"open","locked":false,"title":"Improve memoizing of computed values","user":{"login":"asterius1","id":5724845,"avatar_url":"https://avatars.githubusercontent.com/u/5724845?v=3","gravatar_id":"","url":"https://api.github.com/users/asterius1","html_url":"https://github.com/asterius1","followers_url":"https://api.github.com/users/asterius1/followers","following_url":"https://api.github.com/users/asterius1/following{/other_user}","gists_url":"https://api.github.com/users/asterius1/gists{/gist_id}","starred_url":"https://api.github.com/users/asterius1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterius1/subscriptions","organizations_url":"https://api.github.com/users/asterius1/orgs","repos_url":"https://api.github.com/users/asterius1/repos","events_url":"https://api.github.com/users/asterius1/events{/privacy}","received_events_url":"https://api.github.com/users/asterius1/received_events","type":"User","site_admin":false},"body":"This pull requests rewrites bunch of mobx core to 'change direction' of optimally recalculating changes.\r\n\r\nPreviously it was propagating from changed observables to observing derivations.\r\n\r\nIn proposed approach propagated up is only fact that some deep dependency might have changed (and reactions scheduled from it). Derivations before computing itself can check if any dependencies indeed changed and recompute when appropriate.\r\nIt introduces few big wins:\r\n* When modifications and computations are mixed mobx can still rerun only needed stuff\r\n* When in `autorun(() => a ? b : c)` `a` becomes true `c` is not being recomputed\r\n* Batching of memoization can be introduced. For example `batch(() => { ... })` would make computed memoized for it's duration, giving (as far as I can tell) minimal possible number of recomputations regardless of modifications or reactions.\r\n\r\nOne issue I had is autoruns rerunning itself. Even though all tests for it are ok, I could point out some corner cases in which behaviour slightly change. In general self-rerunning autoruns, even outside this pull request, have many undefined/unexpected behaviours, although those cases can be quite artificial. I was thinking if we could add a rule so changes in autorun can't schedule it for rerun.\r\n\r\n`computed temporary memoization` perf test previews the case, that made me do this in the first place.\r\nCurrently it takes 7 seconds. With changes it's down to ~1ms.\r\nMost perf tests are very similar. Few perform worse.\r\n\r\nThe nicest thing about it is being able to not compromise clear code with performance even while implementing complex dependencies with possibly expensive actions.\r\n\r\nAdjusted few tests, mainly lowering computation count.\r\n\r\nRight now pull request doesn't pass the test for whyRun. Need to adjust language to new changes.","created_at":"2016-08-01T20:58:12Z","updated_at":"2016-08-01T20:58:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mobxjs/mobx/pulls/452/commits","review_comments_url":"https://api.github.com/repos/mobxjs/mobx/pulls/452/comments","review_comment_url":"https://api.github.com/repos/mobxjs/mobx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mobxjs/mobx/issues/452/comments","statuses_url":"https://api.github.com/repos/mobxjs/mobx/statuses/6278b0446c45e373d2f3441c558800d0089b410f","head":{"label":"asterius1:always_track_computed","ref":"always_track_computed","sha":"6278b0446c45e373d2f3441c558800d0089b410f","user":{"login":"asterius1","id":5724845,"avatar_url":"https://avatars.githubusercontent.com/u/5724845?v=3","gravatar_id":"","url":"https://api.github.com/users/asterius1","html_url":"https://github.com/asterius1","followers_url":"https://api.github.com/users/asterius1/followers","following_url":"https://api.github.com/users/asterius1/following{/other_user}","gists_url":"https://api.github.com/users/asterius1/gists{/gist_id}","starred_url":"https://api.github.com/users/asterius1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterius1/subscriptions","organizations_url":"https://api.github.com/users/asterius1/orgs","repos_url":"https://api.github.com/users/asterius1/repos","events_url":"https://api.github.com/users/asterius1/events{/privacy}","received_events_url":"https://api.github.com/users/asterius1/received_events","type":"User","site_admin":false},"repo":{"id":64065282,"name":"mobx","full_name":"asterius1/mobx","owner":{"login":"asterius1","id":5724845,"avatar_url":"https://avatars.githubusercontent.com/u/5724845?v=3","gravatar_id":"","url":"https://api.github.com/users/asterius1","html_url":"https://github.com/asterius1","followers_url":"https://api.github.com/users/asterius1/followers","following_url":"https://api.github.com/users/asterius1/following{/other_user}","gists_url":"https://api.github.com/users/asterius1/gists{/gist_id}","starred_url":"https://api.github.com/users/asterius1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterius1/subscriptions","organizations_url":"https://api.github.com/users/asterius1/orgs","repos_url":"https://api.github.com/users/asterius1/repos","events_url":"https://api.github.com/users/asterius1/events{/privacy}","received_events_url":"https://api.github.com/users/asterius1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/asterius1/mobx","description":"Simple, scalable state management.","fork":true,"url":"https://api.github.com/repos/asterius1/mobx","forks_url":"https://api.github.com/repos/asterius1/mobx/forks","keys_url":"https://api.github.com/repos/asterius1/mobx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asterius1/mobx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asterius1/mobx/teams","hooks_url":"https://api.github.com/repos/asterius1/mobx/hooks","issue_events_url":"https://api.github.com/repos/asterius1/mobx/issues/events{/number}","events_url":"https://api.github.com/repos/asterius1/mobx/events","assignees_url":"https://api.github.com/repos/asterius1/mobx/assignees{/user}","branches_url":"https://api.github.com/repos/asterius1/mobx/branches{/branch}","tags_url":"https://api.github.com/repos/asterius1/mobx/tags","blobs_url":"https://api.github.com/repos/asterius1/mobx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asterius1/mobx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asterius1/mobx/git/refs{/sha}","trees_url":"https://api.github.com/repos/asterius1/mobx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asterius1/mobx/statuses/{sha}","languages_url":"https://api.github.com/repos/asterius1/mobx/languages","stargazers_url":"https://api.github.com/repos/asterius1/mobx/stargazers","contributors_url":"https://api.github.com/repos/asterius1/mobx/contributors","subscribers_url":"https://api.github.com/repos/asterius1/mobx/subscribers","subscription_url":"https://api.github.com/repos/asterius1/mobx/subscription","commits_url":"https://api.github.com/repos/asterius1/mobx/commits{/sha}","git_commits_url":"https://api.github.com/repos/asterius1/mobx/git/commits{/sha}","comments_url":"https://api.github.com/repos/asterius1/mobx/comments{/number}","issue_comment_url":"https://api.github.com/repos/asterius1/mobx/issues/comments{/number}","contents_url":"https://api.github.com/repos/asterius1/mobx/contents/{+path}","compare_url":"https://api.github.com/repos/asterius1/mobx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asterius1/mobx/merges","archive_url":"https://api.github.com/repos/asterius1/mobx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asterius1/mobx/downloads","issues_url":"https://api.github.com/repos/asterius1/mobx/issues{/number}","pulls_url":"https://api.github.com/repos/asterius1/mobx/pulls{/number}","milestones_url":"https://api.github.com/repos/asterius1/mobx/milestones{/number}","notifications_url":"https://api.github.com/repos/asterius1/mobx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asterius1/mobx/labels{/name}","releases_url":"https://api.github.com/repos/asterius1/mobx/releases{/id}","deployments_url":"https://api.github.com/repos/asterius1/mobx/deployments","created_at":"2016-07-24T12:54:00Z","updated_at":"2016-07-24T12:54:02Z","pushed_at":"2016-08-01T20:17:31Z","git_url":"git://github.com/asterius1/mobx.git","ssh_url":"git@github.com:asterius1/mobx.git","clone_url":"https://github.com/asterius1/mobx.git","svn_url":"https://github.com/asterius1/mobx","homepage":"https://mobxjs.github.io/mobx","size":12318,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mobxjs:master","ref":"master","sha":"492481b16bb3378127504a98c95ba5ed0ee5440a","user":{"login":"mobxjs","id":17475736,"avatar_url":"https://avatars.githubusercontent.com/u/17475736?v=3","gravatar_id":"","url":"https://api.github.com/users/mobxjs","html_url":"https://github.com/mobxjs","followers_url":"https://api.github.com/users/mobxjs/followers","following_url":"https://api.github.com/users/mobxjs/following{/other_user}","gists_url":"https://api.github.com/users/mobxjs/gists{/gist_id}","starred_url":"https://api.github.com/users/mobxjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobxjs/subscriptions","organizations_url":"https://api.github.com/users/mobxjs/orgs","repos_url":"https://api.github.com/users/mobxjs/repos","events_url":"https://api.github.com/users/mobxjs/events{/privacy}","received_events_url":"https://api.github.com/users/mobxjs/received_events","type":"Organization","site_admin":false},"repo":{"id":32215970,"name":"mobx","full_name":"mobxjs/mobx","owner":{"login":"mobxjs","id":17475736,"avatar_url":"https://avatars.githubusercontent.com/u/17475736?v=3","gravatar_id":"","url":"https://api.github.com/users/mobxjs","html_url":"https://github.com/mobxjs","followers_url":"https://api.github.com/users/mobxjs/followers","following_url":"https://api.github.com/users/mobxjs/following{/other_user}","gists_url":"https://api.github.com/users/mobxjs/gists{/gist_id}","starred_url":"https://api.github.com/users/mobxjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobxjs/subscriptions","organizations_url":"https://api.github.com/users/mobxjs/orgs","repos_url":"https://api.github.com/users/mobxjs/repos","events_url":"https://api.github.com/users/mobxjs/events{/privacy}","received_events_url":"https://api.github.com/users/mobxjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mobxjs/mobx","description":"Simple, scalable state management.","fork":false,"url":"https://api.github.com/repos/mobxjs/mobx","forks_url":"https://api.github.com/repos/mobxjs/mobx/forks","keys_url":"https://api.github.com/repos/mobxjs/mobx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mobxjs/mobx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mobxjs/mobx/teams","hooks_url":"https://api.github.com/repos/mobxjs/mobx/hooks","issue_events_url":"https://api.github.com/repos/mobxjs/mobx/issues/events{/number}","events_url":"https://api.github.com/repos/mobxjs/mobx/events","assignees_url":"https://api.github.com/repos/mobxjs/mobx/assignees{/user}","branches_url":"https://api.github.com/repos/mobxjs/mobx/branches{/branch}","tags_url":"https://api.github.com/repos/mobxjs/mobx/tags","blobs_url":"https://api.github.com/repos/mobxjs/mobx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mobxjs/mobx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mobxjs/mobx/git/refs{/sha}","trees_url":"https://api.github.com/repos/mobxjs/mobx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mobxjs/mobx/statuses/{sha}","languages_url":"https://api.github.com/repos/mobxjs/mobx/languages","stargazers_url":"https://api.github.com/repos/mobxjs/mobx/stargazers","contributors_url":"https://api.github.com/repos/mobxjs/mobx/contributors","subscribers_url":"https://api.github.com/repos/mobxjs/mobx/subscribers","subscription_url":"https://api.github.com/repos/mobxjs/mobx/subscription","commits_url":"https://api.github.com/repos/mobxjs/mobx/commits{/sha}","git_commits_url":"https://api.github.com/repos/mobxjs/mobx/git/commits{/sha}","comments_url":"https://api.github.com/repos/mobxjs/mobx/comments{/number}","issue_comment_url":"https://api.github.com/repos/mobxjs/mobx/issues/comments{/number}","contents_url":"https://api.github.com/repos/mobxjs/mobx/contents/{+path}","compare_url":"https://api.github.com/repos/mobxjs/mobx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mobxjs/mobx/merges","archive_url":"https://api.github.com/repos/mobxjs/mobx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mobxjs/mobx/downloads","issues_url":"https://api.github.com/repos/mobxjs/mobx/issues{/number}","pulls_url":"https://api.github.com/repos/mobxjs/mobx/pulls{/number}","milestones_url":"https://api.github.com/repos/mobxjs/mobx/milestones{/number}","notifications_url":"https://api.github.com/repos/mobxjs/mobx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mobxjs/mobx/labels{/name}","releases_url":"https://api.github.com/repos/mobxjs/mobx/releases{/id}","deployments_url":"https://api.github.com/repos/mobxjs/mobx/deployments","created_at":"2015-03-14T14:31:38Z","updated_at":"2016-08-01T20:19:51Z","pushed_at":"2016-08-01T20:58:13Z","git_url":"git://github.com/mobxjs/mobx.git","ssh_url":"git@github.com:mobxjs/mobx.git","clone_url":"https://github.com/mobxjs/mobx.git","svn_url":"https://github.com/mobxjs/mobx","homepage":"https://mobxjs.github.io/mobx","size":12419,"stargazers_count":3436,"watchers_count":3436,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":154,"mirror_url":null,"open_issues_count":33,"forks":154,"open_issues":33,"watchers":3436,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mobxjs/mobx/pulls/452"},"html":{"href":"https://github.com/mobxjs/mobx/pull/452"},"issue":{"href":"https://api.github.com/repos/mobxjs/mobx/issues/452"},"comments":{"href":"https://api.github.com/repos/mobxjs/mobx/issues/452/comments"},"review_comments":{"href":"https://api.github.com/repos/mobxjs/mobx/pulls/452/comments"},"review_comment":{"href":"https://api.github.com/repos/mobxjs/mobx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mobxjs/mobx/pulls/452/commits"},"statuses":{"href":"https://api.github.com/repos/mobxjs/mobx/statuses/6278b0446c45e373d2f3441c558800d0089b410f"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":5,"additions":439,"deletions":277,"changed_files":16}}
{"actor":{"display_login":"asterius1"}}