LoxSort is an experimental deterministic C99 sorting library for embedded and resource-constrained systems. It selects an algorithm based on input size, stability requirements, scratch-buffer availability, recursion constraints, and an offline benchmark profile.
LoxSort is part of the Lox family, a set of Liquid Oxygen for Embedded Systems tools and libraries.
- Deterministic dispatcher with explicit policy rules.
- Insertion, Shell, introsort, and bottom-up merge sort.
- Optional cycle sort for specialized builds.
- Stateless public API.
- Offline benchmark and profile generation pipeline.
- CMake export and install support.
- Test suite covering API, algorithms, dispatch, profile logic, and stability.
- Full
1,000,000-dataset release benchmark: completed in this workspace.
The current release evidence shows that the dispatcher is correct and measurable at scale, but it is not globally optimal against the oracle and fixed-strategy baselines on every aggregated view.
LoxSort is a valid experimental project if the goal is a deterministic, constraint-aware sorting library for embedded or otherwise resource-sensitive environments.
Its value is in predictable behavior, explicit policy control, and a benchmark-backed dispatcher that respects stability, scratch-buffer availability, and recursion constraints.
The benchmark results do not support positioning it as a universal performance winner. They do support it as a practical, auditable experimental runtime with clear tradeoffs and a documented decision model.
This section is the practical starting point for users and integrators.
cmake -S . -B build
cmake --build build --config Debug
ctest --test-dir build -C Debug --output-on-failure
LOXSORT_BUILD_TESTSLOXSORT_BUILD_BENCHLOXSORT_ENABLE_CYCLELOXSORT_ENABLE_VERIFYLOXSORT_ENABLE_SANITIZERS
docs/LOXSORT_SPEC.mddocs/API_CONTRACT.mddocs/ARCHITECTURE.mddocs/ALGORITHM_POLICY.mddocs/BENCHMARK_AND_PROFILES.md
#include "loxsort/loxsort.h"
static int int_compare(const void *lhs, const void *rhs, void *user) {
(void)user;
const int left = *(const int *)lhs;
const int right = *(const int *)rhs;
return (left > right) - (left < right);
}
void sort_items(int *items, size_t count) {
lox_sort_options_t options = {0};
lox_sort_result_t result = {0};
options.profile = &lox_profile_generic;
(void)lox_sort(
items,
count,
sizeof(*items),
int_compare,
NULL,
&options,
&result);
}docs/COOKBOOK.mddocs/API_REFERENCE.mddocs/CONTRIBUTING.mddocs/FUZZING.mddocs/RELEASE_NOTES.mddocs/LOXSORT_SPEC.mddocs/API_CONTRACT.mddocs/ARCHITECTURE.mddocs/ALGORITHM_POLICY.mddocs/BENCHMARK_AND_PROFILES.mddocs/TEST_STRATEGY.mddocs/FILE_LAYOUT.mddocs/DECISIONS.md
Use the GitHub issue tracker for bugs, regressions, feature requests, and benchmark anomalies:
https://github.com/Vanderhell/loxsort/issues
When reporting a problem, include:
- target platform and compiler;
- build configuration and enabled CMake options;
- minimal reproduction steps;
- expected vs actual behavior;
- any benchmark CSV or report excerpt that supports the claim.
Contributions are welcome if they preserve the library's deterministic, constraint-aware design.
Before opening a pull request:
- build the project in Debug and Release;
- run the test suite;
- verify any benchmark or profile changes against the existing docs;
- keep generated artifacts out of source changes unless they are intentionally updated;
- update the relevant documentation when behavior changes.
This project is licensed under the MIT License. See LICENSE for the full text.