Getting & Setting value of jQuery form element + FastJS (v10)

Revision 10 of this benchmark created by Heavensrevenge on


Preparation HTML

<script src="//code.jquery.com/jquery-git2.min.js"></script>
<script src="//fastjs.net/js/fast.min.js"></script>

<input id="foo" type="hidden">

Setup

var value = Math.random()*2000|0;
    var $_el = $('#foo');
    var f_el = f('#foo');

Teardown


    value = Math.random()*2000|0;
  

Test runner

Ready to run.

Testing in
TestOps/sec
jQ .val set
$_el.val(value);
ready
jQ[0].value set
$_el[0].value = value;
ready
jQ.attr set
$_el.attr("value", value);
ready
jQ.prop set
$_el.prop("value", value);
ready
FastJS.attr set
f.attr(f_el, "value", value);
ready
jQ .val get
$_el.val();
ready
jQ[0].value get
$_el[0].value;
ready
jQ.attr get
$_el.attr("value");
ready
jQ.prop get
$_el.prop("value");
ready
FastJS.val get
f.val(f_el);
ready
FastJS.attr get
f.attr(f_el, "value");
ready

Revisions

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