performance of parseInt()

JavaScript performance comparison

Revision 32 of this test case created by Henry Zou

Info

Side note on big numbers (32-bit or bigger)

The result of binary operations are signed 32-bit numbers. Standard ECMA-262 5.1

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(x)
parseInt('4')
pending…
parseInt(x, 10)
parseInt('4', 10)
pending…
+x
+'4'
pending…
~~x
~~'4'
pending…
parseFloat(x)
parseFloat('4')
pending…
Number(x)
Number('4')
pending…
new Number(x)
// Please note that new primitives are dangerous
new Number('4')
pending…
Math.floor(x)
Math.floor('4')
pending…
Math.ceil(x)
Math.ceil('4')
pending…
Math.round()
Math.round('4')
pending…
x >> 0
'4' >> 0
pending…
x >>> 0
'4' >>> 0
pending…
x - 0
'4' - 0
pending…
x + 0
'4' + 0
pending…
x * 1
'4' * 1
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