parseInt vs Number

Benchmark created on


Setup

const values = Array.from({ length: 100000 }, () => String(Math.random()).slice(2, 8));
const length = values.length;

Test runner

Ready to run.

Testing in
TestOps/sec
parseInt
for (let i = 0; i < length; i++)
{
	Number.parseInt(values[i], 10);
}
ready
Number
for (let i = 0; i < length; i++)
{
	Number(values[i]);
}

ready

Revisions

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