Intl.Collator.compare (ASCII-only strings) vs String.prototype.localeCompare (ASCII-only strings) vs Intl.Collator.compare vs String.prototype.localeCompareFastest: String.prototype.localeCompare (ASCII-only strings) (3.2x faster)
570 ops/sec
278 ops/sec
193 ops/sec
178 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Intl.Collator.compare (ASCII-only strings) | |
| String.prototype.localeCompare (ASCII-only strings) | |
| Intl.Collator.compare | |
| String.prototype.localeCompare |
| 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 |