parseInt vs. * 1

JavaScript performance comparison

Revision 2 of this test case created by Mike McNally

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
parseInt
(function() {
var a = "1",
    b = "2",
    c = "3000",
    d = 12345;

a = parseInt(a);
b = parseInt(b);
c = parseInt(c);
d = parseInt(d);
})()
pending…
times 1
(function() {
var a = "1",
    b = "2",
    c = "3000",
    d = 12345;

a = a * 1;
b = b * 1;
c = c * 1;
d = d * 1;
})()
pending…
Base 10
(function() {var a = "1",
    b = "2",
    c = "3000",
    d = 12345;

a = parseInt(a, 10);
b = parseInt(b, 10);
c = parseInt(c, 10);
d = parseInt(d, 10);
})()
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. Here’s a list of current revisions for this page:

0 comments

Add a comment