This project is read-only.

ClientBlockRepeater and inline templates

Feb 11, 2015 at 5:22 PM
Edited Feb 11, 2015 at 5:22 PM

I'm running into some performance issues running too many nested ClientBlockRepeaters. The performance problem is caused by KnockOut... it just can't handle a very large number of binding contexts. So I'm exploring my options on how to fix this. One thought is to switch from named KO templates to inline KO templates. According to this article (, inline templates are about 33% faster.

So my question is: can ClientBlockRepeater be used in such a way that it's creating an inline template rather than a named template?
Feb 11, 2015 at 8:20 PM
The 33% improvement is due to the fact that in-line template are instantiated by duplicating javascript Html nodes instead of parsing text into Html nodes. However I have serious doubts that you might solve your performance problem this way. Anyway, ClientBlocks have also the equivalent of in-line templates. See here.

If your performance problem is only in your initial page rendering then the problem is the big number of complex nodes processed by knockout. In this case the only solution is some kind of virtualization and/or paging, In other terms you should avoid the rendering of nodes that are not visible. This may be achieved through paging, and in case of nested loops by using a kind of treeview where children are rendered just when the father is opened the first time.

If the performance problem persists also when you make some change(adding-deleting objects, or changing some observable) then maybe you have some unwanted dependency that force the re-rendering of the whole strucure also when a small change occurs. This situation often happens when you use a template selection function. In fact, in this case when the property used to select the template changes all nested nodes are re-rendered too....In this case you may consider the use of peek() to remove the unwanted dependencies.