performance of parseInt() (v31)

Revision 31 of this benchmark created by Jordan Pickwell on


Description

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

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

  • 11.7 Binary shift operators
  • 11.10 Binary bitwise operators

Test runner

Ready to run.

Testing in
TestOps/sec
parseInt(x)
parseInt('4')
ready
parseInt(x, 10)
parseInt('4', 10)
ready
+x
+'4'
ready
~~x
~~'4'
ready
parseFloat(x)
parseFloat('4')
ready
Number(x)
Number('4')
ready
new Number(x)
// Please note that new primitives are dangerous
new Number('4')
ready
Math.floor(x)
Math.floor('4')
ready
Math.ceil(x)
Math.ceil('4')
ready
Math.round()
Math.round('4')
ready
x >> 0
'4' >> 0
ready
x >>> 0
'4' >>> 0
ready
x - 0
'4' - 0
ready
x + 0
'4' + 0
ready

Revisions

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