best of string to number conversion (v14)

Revision 14 of this benchmark created on


Setup

var abc = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];

Test runner

Ready to run.

Testing in
TestOps/sec
Number()
for (var i = 0, len = abc.length; i < len; ++i) {
  Number(abc[i]);
}
ready
parsetInt()
for (var i = 0, len = abc.length; i < len; ++i) {
  parseInt(abc[i], 10);
}
ready
parseFloat()
for (var i = 0, len = abc.length; i < len; ++i) {
  parseFloat(abc[i]);
}
ready
implicit
for (var i = 0, len = abc.length; i < len; ++i) {
  +abc[i];
}
ready

Revisions

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