jQuery Map vs Array Map

JavaScript performance comparison

Test case created by Nic

Preparation code

<ul class="tabs tabs-centered show-js hide-no-js">
    <a data-type="spirits" href="#">All Spirits (<span>1</span>)</a>
    <a data-type="mixers" href="#">All Mixers (<span>0</span>)</a>
  <li class="is-active">
    <a data-type="garnishes" href="#">All Garnishes (<span>1</span>)</a>
    <a data-type="liquers" href="#">All Liquers (<span>0</span>)</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">

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
jQuery Map
this.dataTypes = $('.tabs [data-type]').map(function() {
  return $(this).data('type')
Array Map
this.dataTypez = $('.tabs [data-type]').toArray().map(function(ele) {
  return $(ele).data('type')

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