jQuery Serialize vs Map

JavaScript performance comparison

Test case created by Nathan

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<form id="test">
  <input type="checkbox" name="test1" value="true" checked="checked">
  <input type="checkbox" name="test2" value="true">
  <input type="checkbox" name="test3" value="true">
</form>
<div id="results">
</div>

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 Serialize
var results = $('#test').serialize();
$('#results').text(results);
pending…
jQuery Map
var results = $('#test').find('input[type="checkbox"]').map(function() {
  return this.name + "=" + this.checked;
}).get().join("&");

$('#results').text(results);
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment