javascript - Profiling jQuery: how to interpret the results -


i have page uses jquery , can run slow in circumstances, , i'm trying profile using firebug , firequery. i've let run, used page... , when results, see functions consuming cpu time are:

elementmatcher/<        (jquery-2.1.0.js (línea 2113)) sizzle</sizzle.selectors.filter.attr/<         (jquery-2.1.0.js (línea 1617)) sizzle</sizzle.attr         (jquery-2.1.0.js (línea 1407)) matcherfromgroupmatchers/supermatcher     (jquery-2.1.0.js (línea 2297)) 

okay. , now... what? how know of selectors consuming cpu, based on data?

(i suspect i'll have rewrite of selectors using attributes right now, based on sizzle</sizzle.selectors.filter.attr/< thing, beyond that, there more information can get?)

to investigate further triggers call sizzle</sizzle.selectors.filter.attr can right-click , choose set breakpoint context menu , trigger action again did before. (maybe page reload required before doing that.)

though improve speed of mentioned selector, might faster when write this:

$("select[name=blabla] > :selected"); 

furthermore can improve performance adding id <select> , query this:

$("#blabla > :selected"); 

it faster using pure javascript instead of jquery, can this:

document.queryselector("#blabla > [selected]"); 

or this:

var blabla = document.getelementbyid("blabla"); blabla.options[blabla.selectedindex]; 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -