Performance of Foreach and Template binding in knockout -


Looking at performance issues with fair and template binding. In our single page app, we have planted nested / project / templates. Below is JSERFURL, which gives information about a simple array without the future and without one; Where the title is better than testing "nested foreach" binding with the "Extended loop markup". It was also found that to get nested and expanded, templates that process through the "Project through template" test takes more time than those without any front.

jsperf url:

Performance with beat 3.1.0

The issue of performance is also present with the Knockout 3.2 version.

Want to know how to reduce load time with nested forward and / or templates binding.

According to the line outlined by the swan, if you really want to squeeze the most performance Viewing Client-Side is working directly with a custom binding archive, creating HTML as a string and is injected using something like element.innerHTML .

Below is a simple:

  ko.bindingHandlers.innerHtml = {init: function (element, valueAccessor) {Var lst = ko.unwrap (valueAccessor ()); If (lst) {var html = ''; For (var i = 0; i  
  & lt; Script src = "https: // cdnjs .cloudflare.com / ajax / libs / knockout / 3.2.0 / knockout-min.js" & gt; & Lt; / Script & gt; & Lt; Ul data-bound = "foreach: $ data.lst" & gt; & Lt; Li & gt; & Lt; Span data-bind = "text: number" & gt; & Lt; / Span & gt; & Lt; Ul data-bound = "INHMT: numAry" & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -