Skip to content Skip to sidebar Skip to footer

Difference In Performance Between Calling .localecompare On String Objects And Constructing A Purpose-made Intl.collator Object?

Background: So I need to sort lots of strings. Arrays of strings, actually, but that's besides the point. What isn't is that I need to implement my own sorter function, as detail

Solution 1:

I'm having a similar issue and found this jsperf really useful.

Bottom line: Yes, Intl.Collator is almost twice as fast than a.localeCompare(b).

Post a Comment for "Difference In Performance Between Calling .localecompare On String Objects And Constructing A Purpose-made Intl.collator Object?"