Hope get your helps. On Thu, Mar 26, 2009 at 1:14 AM, Samuel <samuel.yh...@gmail.com> wrote:
> supplement more information on the issue. > > $('.words') have html data, ie, this node is not empty, so it must cost > some time to remove the children. > > I made tens of tests, and the average of data() function time is around > 500ms, which must be too high. > > It's possible for me to use a iframe to process this if load() usually > consume so much time. the iframe costs around 120ms, which time for > ajax(get) in jquery is around 100ms. so only another 20ms used for redering > css in iframe without js codes added, which might cost a little more loading > and examining time. > > I need to treat the time as a very critical factor, so there is no > negotiation on the time. > > Any suggestion on how to improve the speed is hugely expected, but your > suggestions are iframe are also strikingly hoped. > > Thanks again. > > > > On Thu, Mar 26, 2009 at 12:42 AM, Samuel <samuel.yh...@gmail.com> wrote: > >> Hi, >> >> recently I changed my ajax returned content format to html pieces, using a >> load() function with an expect of time decreasing used for dom manipulation. >> >> On the contract, it could be even longer than the previous xml processing >> time. >> >> After a debugging with firebug, I found the function data() consumes most >> of time, 90% of the total one. Here's a quick illustration: >> >> data()16585.59%457.185ms457.185ms 2.771ms0.007ms11.215msjquery.js (line >> 658)ajax() 12.86%15.267ms17.361ms17.361ms17.361ms17.361msjquery.js (line >> 2583) fix()11.89%10.122ms10.122ms10.122ms10.122ms 10.122msjquery.js (line >> 2092)merge() 291.6%8.554ms8.554ms0.295ms0.003ms6.079msjquery.js (line >> 1155) classFilter()61.5%8.008ms8.008ms1.335ms 0.012ms4.04msjquery.js >> (line 1657)remove() 30.85%4.524ms451.542ms150.514ms7.582ms332.348msjquery.js >> (line 1310) remove()710.8%4.268ms428.967ms6.042ms 6.166ms7.32msjquery.js >> (line 1908)(?)() 20.68%3.633ms4.378ms2.189ms0.116ms4.262msjquery.js (line >> 947) find()140.52%2.751ms19.985ms1.428ms0.14ms 10.527msjquery.js (line >> 1464)append() 50.35%1.843ms1.843ms0.369ms0.04ms1.186msjquery.js (line >> 237) removeData()1060.34%1.793ms1.793ms0.017ms 0.011ms0.318msjquery.js >> (line 684)init() 580.32%1.711ms24.058ms0.415ms0ms10.864ms >> data() function consumed as much as 85% of time, strikingly beyond of my >> expectation which should be less than 100ms. >> >> some code: >> >> >> renderLearning=function(nextUrl,node) { >> >> $('.words').load(nextUrl,function () { >> >> var word=$('#words h1').text(); >> $('#next_word').click(function () { >> renderLearning($('#next_word').attr('href')); >> return false; >> }) >> $('#prev_word').click(function () { >> renderLearning($('#prev_word').attr('href')); >> return false; >> }) >> }) >> } >> >> your helps are highly appreciated. Thanks very much. >> >> Regards, >> -- >> Samuel(吴焱红) >> Blog:http://wuyanhong.blogspot.com >> > > > > -- > Samuel(吴焱红) > Blog:http://wuyanhong.blogspot.com > -- Samuel(吴焱红) Blog:http://wuyanhong.blogspot.com