String To Number conversion

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var string = "1234567890";
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Unary Plus
var out = +string;
pending…
ParseInt
var out = parseInt(string, 10);
pending…
ParseFloat
var out = parseFloat(string);
pending…
Times One
var out = string*1;
pending…
Number cast
var out = Number(string);
pending…

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

Compare results of other browsers

1 comment

Erick RIbeiro commented :

Please check my test: http://jsperf.com/replacechild-removechild/2

Add a comment