Module rayon::slice::mergesort

source ยท
Expand description

Parallel merge sort.

This implementation is copied verbatim from std::slice::sort and then parallelized. The only difference from the original is that the sequential mergesort returns MergesortResult and leaves descending arrays intact.

Structsยง

  • CopyOnDrop ๐Ÿ”’
    When dropped, copies from src into dest a sequence of length len.
  • Run ๐Ÿ”’
    A sorted run that starts at index start and is of length len.

Enumsยง

Functionsยง

  • collapse ๐Ÿ”’
    Examines the stack of runs and identifies the next pair of runs to merge. More specifically, if Some(r) is returned, that means runs[r] and runs[r + 1] must be merged next. If the algorithm should continue building a new run instead, None is returned.
  • decrement_and_get ๐Ÿ”’ โš 
  • get_and_increment ๐Ÿ”’ โš 
  • insert_head ๐Ÿ”’
    Inserts v[0] into pre-sorted sequence v[1..] so that whole v[..] becomes sorted.
  • merge ๐Ÿ”’ โš 
    Merges non-decreasing runs v[..mid] and v[mid..] using buf as temporary storage, and stores the result into v[..].
  • mergesort ๐Ÿ”’ โš 
    Sorts a slice using merge sort, unless it is already in descending order.
  • par_merge ๐Ÿ”’ โš 
    Merges slices left and right in parallel and stores the result into dest.
  • par_mergesort ๐Ÿ”’
    Sorts v using merge sort in parallel.
  • recurse ๐Ÿ”’ โš 
    Recursively merges pre-sorted chunks inside v.
  • split_for_merge ๐Ÿ”’
    Splits two sorted slices so that they can be merged in parallel.