Skip to main content

Module extsort

Module extsort 

Source
Expand description

Disk-backed sorting and spooling for builds larger than memory.

ExternalSorter buffers items until its share of the build MemoryBudget is used (or the shared pool runs out), sorts the buffer, and writes it to a run file in the build scratch directory. Reading merges every run with a k-way heap. When everything fits no run is written and the sort is an ordinary in-memory sort, so a city extract and a planet build share one code path.

Spool is the unsorted sibling: an append-only scratch file replayed in write order.

Structs§

ExternalSorter
Merge
K-way merge over sorted run files.
Scratch
Build scratch directory. Removed with everything in it when dropped.
SortStats
Spill statistics for one sorter, surfaced in the build report.
Spool
Append-only scratch file replayed in write order.
SpoolReader

Enums§

Sorted
Sorted output. The in-memory form keeps its memory reserved until dropped.

Traits§

Spill
A value that can be written to and read back from scratch files.