{"action":"created","issue":{"url":"https://api.github.com/repos/leeoniya/domvm/issues/82","repository_url":"https://api.github.com/repos/leeoniya/domvm","labels_url":"https://api.github.com/repos/leeoniya/domvm/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/leeoniya/domvm/issues/82/comments","events_url":"https://api.github.com/repos/leeoniya/domvm/issues/82/events","html_url":"https://github.com/leeoniya/domvm/issues/82","id":160940826,"number":82,"title":"Explain: Using subviews","user":{"login":"lawrence-dol","id":8662551,"avatar_url":"https://avatars.githubusercontent.com/u/8662551?v=3","gravatar_id":"","url":"https://api.github.com/users/lawrence-dol","html_url":"https://github.com/lawrence-dol","followers_url":"https://api.github.com/users/lawrence-dol/followers","following_url":"https://api.github.com/users/lawrence-dol/following{/other_user}","gists_url":"https://api.github.com/users/lawrence-dol/gists{/gist_id}","starred_url":"https://api.github.com/users/lawrence-dol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lawrence-dol/subscriptions","organizations_url":"https://api.github.com/users/lawrence-dol/orgs","repos_url":"https://api.github.com/users/lawrence-dol/repos","events_url":"https://api.github.com/users/lawrence-dol/events{/privacy}","received_events_url":"https://api.github.com/users/lawrence-dol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-06-17T17:48:46Z","updated_at":"2016-06-17T19:56:12Z","closed_at":null,"body":"@leeoniya \r\n\r\nIf this is in the docs already I can't find it. Could you please briefly explain the difference between using a subview with the following two forms:\r\n\r\n```js\r\n[\"#ui\",                                                     // same as \"div#ui\"\r\n    [SomeViewFn],                                           // sub-view w/closured data\r\n    preInitVm,                                              // pre-initialized ViewModel\r\n]\r\n```\r\n\r\nAlso, I noticed now that the docs only have up to 3 arguments for a subview: `function,model,key`. Is this current? I thought there was a fourth, `options`.\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/leeoniya/domvm/issues/comments/226866681","html_url":"https://github.com/leeoniya/domvm/issues/82#issuecomment-226866681","issue_url":"https://api.github.com/repos/leeoniya/domvm/issues/82","id":226866681,"user":{"login":"leeoniya","id":43234,"avatar_url":"https://avatars.githubusercontent.com/u/43234?v=3","gravatar_id":"","url":"https://api.github.com/users/leeoniya","html_url":"https://github.com/leeoniya","followers_url":"https://api.github.com/users/leeoniya/followers","following_url":"https://api.github.com/users/leeoniya/following{/other_user}","gists_url":"https://api.github.com/users/leeoniya/gists{/gist_id}","starred_url":"https://api.github.com/users/leeoniya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leeoniya/subscriptions","organizations_url":"https://api.github.com/users/leeoniya/orgs","repos_url":"https://api.github.com/users/leeoniya/repos","events_url":"https://api.github.com/users/leeoniya/events{/privacy}","received_events_url":"https://api.github.com/users/leeoniya/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T19:56:12Z","updated_at":"2016-06-17T19:56:12Z","body":"@lawrence-dol it looks like in recent versions, the sub-view overhead has been reduced. in addition, if you have immutable data that you can cheaply diff between redraws, you can use sub-views to greatly increase perf as well.\r\n\r\nthe situation is somewhat nuanced and depends a lot on your data. i just pushed f0768ee41d0a17fcdec948636409c9152b777509 which implements a sub-view based dbmonster with optional immutability optimizations. Notice that the keys in all the subviews are `false`, which speeds up the diff by avoiding any subview reordering lookups and treating them as slots (it works in this dbmonster case because we have knowledge of how the data mutates, same for the immutability optims).\r\n\r\nPlay around with it in all 3 variations across the full range of mutations 0%-100% and look at how the FPS behaves as well as the cost of the \"view update\" (ms)."}}
{"actor":{"display_login":"leeoniya"}}