create dom element

JavaScript performance comparison

Test case created by form

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

      
<script>
Benchmark.prototype.setup = function() {
  var options = {action: "path"};
  

};

Benchmark.prototype.teardown = function() {
  options = null;

};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
another query
$('<form>', {action: options.action})
pending…
one liner
$('<form action="' + options.action + '"></form>');
pending…
var $form
     var $form = $('<form></form>');
     $form.attr('action',options.action); 
pending…
chain
$('<form></form>').attr('action',options.action)
pending…
native mix
$(document.createElement("form")).attr('action',options.action)
pending…
native
var form = document.createElement("form"),
    $form = $(form);
form.action = options.action;
pending…

Compare results of other browsers

Revisions

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

0 Comments