String to int

JavaScript performance comparison

Revision 2 of this test case created

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()
var x = parseInt('01234', 10),
    y = parseInt('20px', 10),
    z = parseInt('2e2');
pending…
Number()
var x = Number('01234'),
    y = Number('20px'),
    z = Number('2e2');
pending…
Unary +
var x = +'01234',
    y = +'20px',
    z = +'2e2';
pending…
Bitwise double negation ~~
var x = ~~'01234',
    y = ~~'20px',
    z = ~~'2e2';
pending…
Multiply by 1
var x = 1*'01234',
    y = 1*'20px',
    z = 1*'2e2';
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