{"action":"created","issue":{"url":"https://api.github.com/repos/ractivejs/ractive/issues/3220","repository_url":"https://api.github.com/repos/ractivejs/ractive","labels_url":"https://api.github.com/repos/ractivejs/ractive/issues/3220/labels{/name}","comments_url":"https://api.github.com/repos/ractivejs/ractive/issues/3220/comments","events_url":"https://api.github.com/repos/ractivejs/ractive/issues/3220/events","html_url":"https://github.com/ractivejs/ractive/pull/3220","id":309886646,"number":3220,"title":"Refactor reference expression impl and allow dynamic ref depths","user":{"login":"evs-chris","id":161978,"avatar_url":"https://avatars3.githubusercontent.com/u/161978?v=4","gravatar_id":"","url":"https://api.github.com/users/evs-chris","html_url":"https://github.com/evs-chris","followers_url":"https://api.github.com/users/evs-chris/followers","following_url":"https://api.github.com/users/evs-chris/following{/other_user}","gists_url":"https://api.github.com/users/evs-chris/gists{/gist_id}","starred_url":"https://api.github.com/users/evs-chris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evs-chris/subscriptions","organizations_url":"https://api.github.com/users/evs-chris/orgs","repos_url":"https://api.github.com/users/evs-chris/repos","events_url":"https://api.github.com/users/evs-chris/events{/privacy}","received_events_url":"https://api.github.com/users/evs-chris/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-29T20:07:05Z","updated_at":"2018-03-30T19:09:57Z","closed_at":"2018-03-29T20:44:46Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ractivejs/ractive/pulls/3220","html_url":"https://github.com/ractivejs/ractive/pull/3220","diff_url":"https://github.com/ractivejs/ractive/pull/3220.diff","patch_url":"https://github.com/ractivejs/ractive/pull/3220.patch"},"body":"## Description:\r\nThis tosses most of the old `ReferenceExpressionProxy` code and just swaps in a specialized `LinkModel` subclass. In addition to being considerably smaller, this also allows for a minor feature addition I've been wanting for a while: dynamic depth reference expressions. \"Ooooh\", you say. \"That sounds lovely!\". And indeed it is, because you can have fully bindable dynamic references with `~/[someKeypathArray]`, and the array will be expanded inline when stringing together the keypath. Multiple keys are still possible, and will behave how you'd expect when mixing arrays and strings/numbers.\r\n\r\n## Fixes the following issues:\r\nA little bloat.\r\n\r\n## Is breaking:\r\nDon't think so... at least all of the tests turn green.\r\n"},"comment":{"url":"https://api.github.com/repos/ractivejs/ractive/issues/comments/377599316","html_url":"https://github.com/ractivejs/ractive/pull/3220#issuecomment-377599316","issue_url":"https://api.github.com/repos/ractivejs/ractive/issues/3220","id":377599316,"user":{"login":"evs-chris","id":161978,"avatar_url":"https://avatars3.githubusercontent.com/u/161978?v=4","gravatar_id":"","url":"https://api.github.com/users/evs-chris","html_url":"https://github.com/evs-chris","followers_url":"https://api.github.com/users/evs-chris/followers","following_url":"https://api.github.com/users/evs-chris/following{/other_user}","gists_url":"https://api.github.com/users/evs-chris/gists{/gist_id}","starred_url":"https://api.github.com/users/evs-chris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evs-chris/subscriptions","organizations_url":"https://api.github.com/users/evs-chris/orgs","repos_url":"https://api.github.com/users/evs-chris/repos","events_url":"https://api.github.com/users/evs-chris/events{/privacy}","received_events_url":"https://api.github.com/users/evs-chris/received_events","type":"User","site_admin":false},"created_at":"2018-03-30T19:09:57Z","updated_at":"2018-03-30T19:09:57Z","author_association":"CONTRIBUTOR","body":"Here's my list of things to do or not do if performance is a concern:\r\n\r\n1. __Most importantly__, pre-parse your templates! This requires a build step, but it really does make a difference in speed. You lose a little bit of space because the parsed templates are slightly larger than the template text in most cases, but it also lets you use the runtime version of ractive, which saves ~30k minified off of the top.\r\n2. Components are great, but don't use them unnecessarily. Components have a pretty significant overhead, so if possible, avoid using them in iterative sections. This is one of the reasons that macro partials were introduced - you get a lot of the benefits of a component without the extra overhead, with the only significant downsides being no access to extra methods on the macro and no separate eventing system.\r\n3. Don't render giant structures directly to the DOM. If you have a list of 100 items to render, that's probably fine, though depending on their size, your users would probably still thank you to paginate that and give them some sort of filtering. Rendering a large tree with all nodes already expanded is probably not something you're going to want to navigate either.\r\n4. Use lazy input bindings wherever possible when the bound value affects other parts of the template. For instance, when having a filter input adjust the list of items displayed below it, set lazy to a number so that every keystroke doesn't immediately hit the DOM.\r\n5. For things like tabs and accordions, go ahead and render everything to the DOM ahead of time with something like `display: none` for the bits that shouldn't be visible. This makes switching faster and you don't run into weird things like components on hidden sections losing their local state when they are torn down and recreated as they are hidden and shown again.\r\n6. Use CSS transitions when you can, as opposed to using `animate`. `animate` is still super handy for handling things that CSS transitions can't, but a CSS transition or a ractive transition plugin that uses CSS transitions under the hood is going to be more performant in most of the cases that they _can_ be used.\r\n\r\nThere're probably some other things you can do to improve performance, but after the third one in this list, they're usually either very case specific or bordering on a micro-optimization e.g. saving 1ms on a 3ms action is often not worth the extra effort and complexity. While sticking with the top 3 items in this list, I have yet to run across a serious performance issue in any of my ractive apps for any version from 0.7 on."}}
{"actor":{"display_login":"evs-chris"}}