Sort Array<String> VS parseInt + sort

Benchmark created on


Setup

var arr = new Array(100).fill(0).map(() => (Math.random() * 10000000000000).toFixed());

Test runner

Ready to run.

Testing in
TestOps/sec
String sort
arr.toSorted();
ready
Convert to int + sort
arr.map(value => parseInt(value, 10)).toSorted();
ready

Revisions

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