performance of parseInt() (v38)

Revision 38 of this benchmark created 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

Setup

var str = "4";

Test runner

Ready to run.

Testing in
TestOps/sec
parseInt(x)
var i = parseInt(str)
ready
parseInt(x, 10)
var i = parseInt(str, 10)
ready
+x
var i = +str
ready
~~x
var i = ~~str
ready
x|0
var i = str|0
ready
x >> 0
var i = str >> 0
ready

Revisions

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