We explored an uncharted part of the solution space for sorting algorithms: the role of symmetry in divide&conquer algorithms. We found/designed novel simple binary Quicksort and Mergesort algorithms operating in contiguous space which achieve improved trade-offs between worst-case CPU-efficiency, best-case adaptivity and RAM-requirements. The 'greeNsort' algorithms need less hardware (RAM) and/or less energy (CPU) compared to the prior art. The new algorithms fit a theoretical framework: 'Footprint' KPIs allow to compare algorithms with different RAM-requirements, a new 'definition' of sorting API-targets simplifies construction of stable algorithms with mirrored scan directions, and our ordinal machine model encourages robust algorithms that minimize access 'distance'. Unlike earlier 'Quicksorts', our 'Zacksort', 'Zucksort' and 'Ducksort' algorithms optimally marry CPU-efficiency and tie-adaptivity. Unlike earlier 'Mergesorts' which required 100% distant buffer, our 'Frogsort' and 'Geckosort' algorithms achieve similar CPU-efficiency with 50% or less local buffer. Unlike natural Mergesorts such as 'Timsort' which are optimized for the best case of full-presorting, our 'Octosort' and 'Squidsort' algorithms achieve excellent bi-adaptivity to presorted best-cases without sacrificing worst-case efficiency in real sorting tasks. Our 'Walksort' and 'Jumpsort' have lower Footprint than the impressive low-memory 'Grailsort' and 'Sqrtsort' of Astrelin. Given the current climate-emergency, this is a call to action for all maintainers of sorting libraries, all software-engineers using custom sorting code, all professors teaching algorithms, all IT professionals designing programming languages, compilers and CPUs: check for better algorithms and consider symmetric code-mirroring.
翻译:我们探索了排序算法解空间中一个未被充分研究的领域:分治算法中对称性的作用。我们设计/发现了在连续空间内运行的简单二元快速排序和归并排序新算法,这些算法在最优情况下的CPU效率、最佳情况下的自适应性和RAM需求之间实现了更优的权衡。与现有技术相比,“greeNsort”算法需要更少的硬件(RAM)和/或更少的能源(CPU)。这些新算法符合理论框架:“足迹”关键绩效指标(KPI)允许比较不同RAM需求的算法;一种新的排序API目标定义简化了具有镜像扫描方向的稳定算法的构建;我们的序数机器模型鼓励开发最小化访问“距离”的鲁棒算法。与早期的“快速排序”不同,我们的“Zacksort”、“Zucksort”和“Ducksort”算法在CPU效率和连接自适应性之间实现了最优结合。与需要100%远程缓冲区的早期“归并排序”不同,我们的“Frogsort”和“Geckosort”算法使用50%或更少的本地缓冲区即可达到类似的CPU效率。与针对完全预排序最优情况优化的自然归并排序(如“Timsort”)不同,我们的“Octosort”和“Squidsort”算法在面对预排序最优情况时实现了出色的双自适应性,且不会牺牲实际排序任务中的最坏情况效率。我们的“Walksort”和“Jumpsort”算法相比Astrelin令人印象深刻的内存高效算法“Grailsort”和“Sqrtsort”具有更低的足迹。在当前气候紧急状况下,我们呼吁所有排序库维护者、使用自定义排序代码的软件工程师、教授算法的教授、设计编程语言、编译器和CPU的IT专业人士:检查是否有更好的算法,并考虑对称代码镜像化。