This table compares the performance of two alphanum comparison function along with the one that is now built into the latest JavaScript. It does the comparisons by sorting some sample data many, many times. The first algorithm is provided by this project, and the second is provided by @epascarello at Stack Overflow. The third algorithm uses built-in localeCompare with the {numeric: true} option.
Note that sorting speed is only one criterion. It's also important that the algorithm give the right answer! The accepted solution on Stack Exchange does not. The built-in localCompare() is exceedingly slow.
| @timkay benchmarking... |
@epascarello benchmarking... |
{numeric: true} benchmarking... |
| Sample Set 1, sorted | ||
| Sample Set 2, sorted | ||