On Maze

JavaScript performance comparison

Test case created by Josh

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
<div id="home-menu">
    <li id="home-nav">
      <a href="/" class="home-link other-link"><img src="/img/transparent.png" class="home-nav-house" alt="Cynergy. The Experience Agency" width="26" height="25"></a>
    <li id="http://jsperf.com/on-mazing">
      <a href="/who_we_are/" class="other-link"><strong>WHO</strong> WE ARE</a>
    <li id="what-we-do-nav">
      <a href="/what_we_do/" class="other-link"><strong>WHAT</strong> WE DO</a>
    <li id="how-we-do-it-nav">
      <a href="/how_we_do_it/" class="other-link"><strong>HOW</strong> WE DO IT</a>
    <li id="our-work-nav">
      <a href="/our_work/" class="other-link">OUR <strong>WORK</strong></a>
    <li id="contact-nav">
      <a href="/contact/" class="other-link"><strong>CONTACT</strong> US</a>
Benchmark.prototype.setup = function() {
    b = 0;
    a = function() {
      b += 1;
    $('div#home-menu').on('click', '#contact-nav .other-link', a);
    $('.home-link').on('click', a);
    $('div#home-menu ul li#who-we-are-nav a.other-link').on('click', a);

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Simple on
$('#home-nav .other-link').trigger('click');
complex on
$('#what-we-do-nav .other-link').trigger('click');
delegated on
$('#home-menu .other-link').trigger('click');

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Comment form temporarily disabled.

Add a comment