javascript - Query performance in minimongo -


i built responsive forum demo rendered topic list on mobile device. unresponsive when collection updated. think reason query.

my test html:

<template name="index">   <h1 id="mytime"></h1>   {{#each foo}}   <h1>{{name}}</h1>   {{/each}}   <input id="t" type="text"></input>   <button id="s">submit</button> </template> 

and js:

template.index.foo = function () {   return foo.find({}).fetch(); };  template.index.events({   "click #s": function () {     foo.insert({name: $("#t").val()});   } });  meteor.startup(function () {   meteor.setinterval(function () {     $("#mytime").text((new date()).gettime());   }, 1); }); 

when number of documents small, code works fast. when number of documents larger 300 , rendering stop 3s

is possible improve it? :)

are doing dom insertions @ every iteration of loop? it's easier create document fragment, append that, , append fragment in dom @ end of loop. logic stays same, browser has repaint page once @ end, opposed every iteration.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -