toString base

Benchmark created by strager on


Preparation HTML

<script>
  var numbers = [ 3, 489, 349.22456, 3939.2, 4948984.43984, 1e21, 9.457392e-18 ];
  
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.toString()
var s;

for (var i = 0; i < numbers.length; ++i) {

s = numbers[i].toString();

}
 
ready
+ ""
var s;

for (var i = 0; i < numbers.length; ++i) {

s = numbers[i] + "";

}
 
ready
.toString(16)
var s;

for (var i = 0; i < numbers.length; ++i) {

s = numbers[i].toString(16);

}
 
ready
.toString(8)
var s;

for (var i = 0; i < numbers.length; ++i) {

s = numbers[i].toString(8);

}
 
ready

Revisions

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

  • Revision 1: published by strager on