Number vs parseFloat (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script>
  var na = [-0.707, 1.0, -1.0, 0, 0.707, 0.33, 0.66];
  var nb = ["-0.707", "1.0", "-1.0", "0", "0.707", "0.33", "0.66"];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
parseFloat
var n0 = parseFloat(nb[0]);
var n1 = parseFloat(nb[1]);
var n2 = parseFloat(nb[2]);
var n3 = parseFloat(nb[3]);
var n4 = parseFloat(nb[4]);
var n5 = parseFloat(nb[5]);
var n6 = parseFloat(nb[6]);
var n7 = n0 + n1 * n2 - n3 / n4 + n5;
var n8 = n0 + n1 * n2 - n3 / n4 + n5;
var n9 = n0 + n1 * n2 - n3 / n4 + n5;
var n10 = n0 + n1 * n2 - n3 / n4 + n5;
var n11 = n0 + n1 * n2 - n3 / n4 + n5;
var n12 = n0 + n1 * n2 - n3 / n4 + n5;
var n13 = n0 + n1 * n2 - n3 / n4 + n5;
var n14 = n0 + n1 * n2 - n3 / n4 + n5;
ready
float
var n0 = (na[0]);
var n1 = (na[1]);
var n2 = (na[2]);
var n3 = (na[3]);
var n4 = (na[4]);
var n5 = (na[5]);
var n6 = (na[6]);
var n7 = n0 + n1 * n2 - n3 / n4 + n5;
var n8 = n0 + n1 * n2 - n3 / n4 + n5;
var n9 = n0 + n1 * n2 - n3 / n4 + n5;
var n10 = n0 + n1 * n2 - n3 / n4 + n5;
var n11 = n0 + n1 * n2 - n3 / n4 + n5;
var n12 = n0 + n1 * n2 - n3 / n4 + n5;
var n13 = n0 + n1 * n2 - n3 / n4 + n5;
var n14 = n0 + n1 * n2 - n3 / n4 + n5;
ready
string
var n0 = (nb[0]);
var n1 = (nb[1]);
var n2 = (nb[2]);
var n3 = (nb[3]);
var n4 = (nb[4]);
var n5 = (nb[5]);
var n6 = (nb[6]);
var n7 = n0 + n1 * n2 - n3 / n4 + n5;
var n8 = n0 + n1 * n2 - n3 / n4 + n5;
var n9 = n0 + n1 * n2 - n3 / n4 + n5;
var n10 = n0 + n1 * n2 - n3 / n4 + n5;
var n11 = n0 + n1 * n2 - n3 / n4 + n5;
var n12 = n0 + n1 * n2 - n3 / n4 + n5;
var n13 = n0 + n1 * n2 - n3 / n4 + n5;
var n14 = n0 + n1 * n2 - n3 / n4 + n5;
ready

Revisions

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