Patience is a Virtue: Revisiting Merge and Sort on Modern Processors

被引:16
|
作者
Chandramouli, Badrish [1 ]
Goldstein, Jonathan [1 ]
机构
[1] Microsoft Res, Redmond, WA 98052 USA
关键词
Sorting; Patience; Merging; Replacement Selection; Performance;
D O I
10.1145/2588555.2593662
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
The vast quantities of log-based data appearing in data centers has generated an interest in sorting almost-sorted datasets. We revisit the problem of sorting and merging data in main memory, and show that a long-forgotten technique called Patience Sort can, with some key modifications, be made competitive with today's best comparison-based sorting techniques for both random and almost sorted data. Patience sort consists of two phases: the creation of sorted runs, and the merging of these runs. Through a combination of algorithmic and architectural innovations, we dramatically improve Patience sort for both random and almost-ordered data. Of particular interest is a new technique called ping-pong merge for merging sorted runs in main memory. Together, these innovations produce an extremely fast sorting technique that we call P-3 Sort (for Ping-Pong Patience+ Sort), which is competitive with or better than the popular implementations of the fastest comparison-based sort techniques of today. For example, our implementation of P3 sort is around 20% faster than GNU Quicksort on random data, and 20% to 4x faster than Timsort for almost sorted data. Finally, we investigate replacement selection sort in the context of single-pass sorting of logs with bounded disorder, and leverage P3 sort to improve replacement selection. Experiments show that our proposal, P3 replacement selection, significantly improves performance, with speedups of 3x to 20x over classical replacement selection.
引用
收藏
页码:731 / 742
页数:12
相关论文
共 50 条
  • [2] Is Patience a Virtue?
    Vigani, Denise
    [J]. JOURNAL OF VALUE INQUIRY, 2017, 51 (02): : 327 - 340
  • [3] Patience Is a Virtue
    Schneider, Craig S.
    Willey, Christopher D.
    [J]. INTERNATIONAL JOURNAL OF RADIATION ONCOLOGY BIOLOGY PHYSICS, 2022, 113 (01): : 12 - 12
  • [4] Is Patience a Virtue?
    Denise Vigani
    [J]. The Journal of Value Inquiry, 2017, 51 : 327 - 340
  • [5] PATIENCE IS A VIRTUE
    WOOLF, G
    [J]. CHEMICAL ENGINEER-LONDON, 1994, (564): : 3 - 3
  • [6] The virtue of patience
    Westlake, Michael
    [J]. AEROSPACE AMERICA, 2011, 49 (04) : 8 - 10
  • [7] Patience is a virtue
    Walkley, Carl R.
    [J]. BLOOD, 2022, 139 (04) : 481 - 482
  • [8] Patience is a virtue
    Noailly, Joelle
    [J]. NATURE ENERGY, 2016, 1
  • [9] Patience Is a Virtue
    Kollmeier, Marisa A.
    [J]. INTERNATIONAL JOURNAL OF RADIATION ONCOLOGY BIOLOGY PHYSICS, 2022, 113 (02): : 256 - 256
  • [10] 'Patience is a virtue'
    Rosser, JA
    [J]. PLOUGHSHARES, 2000, 26 (01) : 151 - 151