Note the use of a custom comparison function (compareIDs), which is used to compare numeric field (id) being sorted by. Sorting using LSD Radix Sort is shown below:
Note the custom function (getKey), which provides access to the numeric value being sorted by.
Because each object holds more data than just numbers, the Chrome browser runs out of memory at smaller array size – around 10 million elements.
Surprisingly, it’s only a tiny modification to the LSD Radix Sort implementation to support sorting arrays of objects. The modification is the addition of getKey function. The rest of the code is the same as was used for sorting arrays of unsigned integers.
Enjoy, and let me know if it’s been helpful.