Hello everyone, While reviewing the array.c code base, I have noticed that the array_multisort function still uses the old zend_qsort instead of the new zend_sort algorithm that was introduced with PHP 7.
That represents a clear inconsistency, because all other array sorting functions utilize the advanced implementation of quicksort (through zend_hash_sort) that was derived from LLVM's libc++ implementation of std::sort (https://marc.info/?l=php-internals&m=142047779209352). Not only is zend_qsort less efficient, but moreover, because it doesn't rely on the insertion sort fallback for small array chunks that zend_sort provides (which yields a more stable sorting order), the result might in effect actually differ from that of all the other array sorting functions. IMHO this inconsistency can be considered a bug. Also, array_multisort is the only remnant in PHP core that still uses zend_qsort (https://github.com/php/php-src/search?q=zend_qsort). If we would eliminate that inconsistency, we could probably dispense with the then obsolete zend_qsort all together. Please let me know your thoughts. Thanks, Ben -- Bejamin Coutu ben.co...@zeyos.com ZeyOS, Inc. http://www.zeyos.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php