LOX · Liquid Oxygen for Embedded Systems

LOX Sort

One fixed sorting algorithm cannot satisfy every stability, scratch and recursion constraint.

A stateless dispatcher selects among eligible C99 algorithms using explicit constraints and an offline profile.

ExperimentalMITC99
Last verified
Not audited against current README/docs
Platform scope
Portable C99; integration depends on caller-provided adapters

What it solves

One fixed sorting algorithm cannot satisfy every stability, scratch and recursion constraint.

How it works

1Data constraints2dispatcher + profile3eligible algorithm4result

Use it when

Sort small nearly ordered arrays with low overhead
Require stable ordering when scratch memory is available
Avoid recursion in a constrained build
Audit why a strategy was selected

Quick Start

#include "loxsort/loxsort.h"
lox_sort_options_t opt={0}; lox_sort_result_t result={0};
opt.profile=&lox_profile_generic;
(void)lox_sort(items,count,sizeof *items,int_compare,NULL,&opt,&result);
/* Expected: sorted items and a reported selected strategy. */

Engineering evidence

  • Tests cover API, algorithms, dispatch, profile logic and stability
  • A one-million-dataset release benchmark is documented, including non-optimal aggregate views

Known limits

  • Experimental; not presented as a universal performance winner
  • Stable merge requires a full scratch buffer
  • Profile quality depends on offline benchmark data