LSD Radix Sort for Large Numeric Arrays in MQL
Summary
The document explains a least-significant-digit radix sort that processes numeric values byte by byte, using 8-bit digits. It presents an MQL implementation intended for large arrays and describes support for several integer and floating-point types, ascending ordering, index sorting, and parallel sorting of associated items. For floating-point values, the method transforms IEEE-754 bit patterns into order-preserving integer keys; special values retain an ordering based on those representations.
The stated complexity is linear in the number of elements for each digit position, while comparison sorts scale with the logarithm of array size per element. The implementation falls back to the built-in sort below a threshold and requires temporary memory. A benchmark example reports substantially faster sorting of a large integer array than the built-in MQL routine, but this is one implementation-specific example, not a general guarantee. The method can help quant workflows that repeatedly sort large numeric datasets, though its memory use and performance should be evaluated in the target environment.
Key ideas
- LSD radix sort orders values by processing digit or byte positions from least to most significant.
- The described MQL implementation uses 8-bit digits and supports numeric arrays and related sorting utilities.
- Floating-point values are mapped from IEEE-754 representations to order-preserving keys.
- The algorithm uses temporary memory and switches to the built-in sort for small arrays.
- The reported benchmark is implementation-specific and does not guarantee speedups in every workload.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.