Rust external sort
ext-sort is a rust external sort algorithm implementation.
External sorting is a class of sorting algorithms that can handle massive amounts of data. External sorting is required when the data being sorted do not fit into the main memory (RAM) of a computer and instead must be resided in slower external memory, usually a hard disk drive. Sorting is achieved in two passes. During the first pass it sorts chunks of data that each fit in RAM, during the second pass it merges the sorted chunks together. For more information see External Sorting.
Overview
ext-sort supports the following features:
- Data agnostic:
it supports all data types that implement
serdeserialization/deserialization by default, otherwise you can implement your own serialization/deserialization mechanism. - Serialization format agnostic:
the library uses
MessagePackserialization format by default, but it can be easily substituted by your custom one ifMessagePackserialization/deserialization performance is not sufficient for your task. - Multithreading support: multi-threaded sorting is supported, which means data is sorted in multiple threads utilizing maximum CPU resources and reducing sorting time.
- Memory limit support:
memory limited sorting is supported. It allows you to limit sorting memory consumption
(
memory-limitfeature required).
Basic example
Activate memory-limit feature of the ext-sort crate on Cargo.toml:
[]
= { = "^0.1.5", = ["memory-limit"] }
use fs;
use ;
use path;
use MB;
use env_logger;
use log;
use ;