Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I did a statistical analysis of <code>.bind()</code> vs <code>.live()</code> vs <code>.delegate()</code> using FF profiler. I did 10 rounds of each (not a sufficient sample to be definitive, but illustrates the point). These are the results.</p> <p>1) Single static element with an id using the click event:</p> <pre><code>.bind(): Mean = 1.139ms, Variance = 0.1276ms .live(): Mean = 1.344ms, Variance = 0.2403ms .delegate(): Mean = 1.290ms, Variance = 0.4417ms </code></pre> <p>2) Multiple static elements with a common class using the click event:</p> <pre><code>.bind(): Mean = 1.089ms, Variance = 0.1202ms .live(): Mean = 1.559ms, Variance = 0.1777ms .delegate(): Mean = 1.397ms, Variance = 0.3146ms </code></pre> <p>3) Multiple dynamic elements (first button creates second...) using the click event:</p> <pre><code>.bind(): Mean = 2.4205ms, Variance = 0.7736ms .live(): Mean = 2.3667ms, Variance = 0.7667ms .delegate(): Mean = 2.1901ms, Variance = 0.2838ms </code></pre> <p>Interpret how you wish, but it seems to me that as dynamic elements increase on a page, .delegate() seems to have the best performance while static elements perform best with .bind().</p> <p>Keep in mind that I am using a very simple click event triggering an alert. Different pages, with different environments (ie. CPU, multi-tab browsing, running threads, etc) will render differing results. I used this as a basic guideline for my decision to use one or the other. Please advise if you have come up with a different result.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload