Script Preparation code:
Tests:

Historical Performance Data aggregated from 9 community runs

Desktop Results:
Chrome 9 runs
String.prototype.localeCompare (ASCII-only strings)
570/s
Intl.Collator.compare (ASCII-only strings)
278/s
Intl.Collator.compare
193/s
String.prototype.localeCompare
178/s

Fastest: String.prototype.localeCompare (ASCII-only strings) (3.2x faster)

View exact numbers
  • String.prototype.localeCompare (ASCII-only strings): 570 ops/sec
  • Intl.Collator.compare (ASCII-only strings): 278 ops/sec
  • Intl.Collator.compare: 193 ops/sec
  • String.prototype.localeCompare: 178 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Intl.Collator.compare (ASCII-only strings)
    String.prototype.localeCompare (ASCII-only strings)
    Intl.Collator.compare
    String.prototype.localeCompare

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
Chrome 147 on Windows
View result in a separate tab
String.prototype.localeCompare (ASCII-only strings)
587/s
Intl.Collator.compare (ASCII-only strings)
257/s
String.prototype.localeCompare
253/s
Intl.Collator.compare
193/s
View exact numbers
Test name Executions per second
String.prototype.localeCompare (ASCII-only strings) 587 Ops/sec
Intl.Collator.compare (ASCII-only strings) 257 Ops/sec
String.prototype.localeCompare 253 Ops/sec
Intl.Collator.compare 193 Ops/sec