Locale compare vs collator compare (v2)

Revision 2 of this benchmark created on


Setup

const unordered_array = ['1b', '1a', 'b', 'a'];
const unordered_array2 = ['1b', '1a', 'b', 'a'];
const collator = new Intl.Collator();

Test runner

Ready to run.

Testing in
TestOps/sec
Collator
unordered_array.sort(collator.compare);
ready
Locale compare
unordered_array2.sort((a, b) => a.localeCompare(b));
ready

Revisions

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