LayerKeySort Full · C17 library · v4.1.0 Stable

Keep changing collections in order.

LayerKeySort keeps changing collections in explicit or comparator-managed order. Live occurrences have stable contextual handles; immutable snapshots provide sortable historical keys. Your application owns item identity.

A small change in position

BeforeBackgroundPlayerHUD
AfterBackgroundPlayerEffectsHUD

Live moves preserve resident handles. Capture an immutable snapshot when historical or persistent order is needed; snapshot keys are not live positions or permanent item IDs.

Start here

Choose your next step

Getting the code

One library, several ways to use it

For a small C project, download the two-file amalgamation from the Full v4.1.0 Release. Copy layerkeysort.h and layerkeysort.c into your project and compile the implementation as C17.

Already using CMake? Choose FetchContent, add_subdirectory, or a local install with find_package. The integration guide has complete commands; 中文集成指南 covers the same first-use paths.

LayerKeySort Full v4.1.0 is the current published Stable Release, with compatible memory optimizations, a verified amalgamation ZIP and SHA-256 manifest. Performance remains workload-dependent. V3.1.0 remains available for legacy Path/Tree contracts.

See the model

Watch positions change

The historical V3 visualizer replays Path snapshots recorded from the production C implementation. It helps explain manual and comparator-managed Trees; the browser does not execute the C library.

Open visualizer

Before you adopt it

Measure the workload that matters to you

V4 avoids live Path growth and collection-wide coordinate relabel. Local block/index work, allocation and comparator costs remain; full snapshot export and retained history can dominate time and memory. The strongest fit is a long-lived editor-like collection with repeated insert/remove/move operations, not one-shot sorting or distributed/CRDT ordering. Read the benchmark evidence, test your own workload, and follow the post-v4 roadmap.