Ashroot structural cost and overhead benchmark
Start with the qualification, native structural observations and maintained bench. The design brief below records the comparison chosen before implementation; qualified source generations and their measurement limits are recorded separately.
3 November 2026. User request: measure the necessary underlying structure work
for every Ashroot data API, compare Ashroot with a well-structured direct
implementation, then optimize measured gaps. This follows the separately
committed core qualification.
Baseline product code is newstack a055647635638f0fbf2822fb9f9cae0348d824c6,
SDK 51f050bae1ea43114c95bd21010355bf67163220; the core evidence/navigation
commit is 26961842.
The complete API ledger enumerates runtime methods, aliases, iterator behavior, planner, migrations, lifecycle and compile-only helpers. The structure review checks the SDK implementations and pinned Rust source, including limitations of retained entries, stable cursors, Minima directories and sorted construction. These are source findings, not measured savings.
Chosen comparison
Keep an analytic operation count and actual measured controls together:
- A prepared primitive/composition control measures the required primary/index operations, codecs and ownership work on inputs satisfying named preconditions. Its lower-bound counts are not a claim of a globally optimal instruction count.
- Direct checked controls implement the full operation and its errors, bounds, ordering and lifetime behavior. Measure both a flat private owner and a split owner layout where their costs differ. Report both layouts and footprint; pointwise minima do not imply that one layout achieves every minimum at once.
- Ashroot uses the same logical schema, inputs, populations, output work and required integrity. The historical manual application is not the new floor.
Prepared controls are component measurements, not application APIs. Invalid or refused cases need the checked reference. A complete five-write composition is measured directly; adding five independent timing samples can miss interaction and page costs. Show the matched empty actor/Store/Wire frame separately and retain whole-update/upgrade costs, already including page charges.
The ordinary reference starts with this native case:
// Inside one private owner loan; all maps/sets use the Nyxus allocator.
// This case has four ordinary indexes and no FK/unique preflight.
let Data { primary, ages, names, countries, scores } = data;
let Entry::Vacant(slot) = primary.entry(id) else {
return Err(Error::DuplicatePrimary);
};
validate(&row)?;
let keys = (row.age, row.name, row.country, row.score);
slot.insert(row); // one primary search and insertion
assert!(ages.insert((keys.0, id)));
assert!(names.insert((keys.1, id)));
assert!(countries.insert((keys.2, id)));
assert!(scores.insert((keys.3, id))); // four secondary insertions
This is aspirational reference code, not a measured implementation. Self-FKs to another ID cannot read the same map while its mutable Entry is held. Hylix has no public prepared-entry continuation. Those are explicit primitive gaps; do not manufacture a one-search baseline with unsafe node tokens. Expected errors must precede mutation, and failures after mutation trap the complete execution.
Implementation shape
Maintained fixture code, case definitions, direct controls, coverage and reporting
belong in bench/ashroot-overhead/. Use a shared bounded Wire protocol and
compile-selected Nyxus/Hylix/Minima and checked/direct implementations. Keep
source-known schema dispatch static; add no runtime registry or mode flag to
Ashroot itself. Roots stay declarative, memory types versioned, providers private
and views synchronous. Component controls have separate prepared-case oracles.
Cover zero/one/four ordinary indexes, unique/sparse/descending indexes, all relationship policies, plain and owning rows where admitted, short/large keys, and several populations and result counts. A descending score index keeps PK ties ascending. Direct references implement their own integrity algorithms; sharing Ashroot's generic planner would hide its cost.
Every public method has a coverage entry with case IDs or an explicit compile-only or inapplicable reason. Lazy cases check iterator consumption, early stop, mapper failure and caller suffixes. Mutation cases check exact final primary/index/FK state, ordinary refusals, bounds, owning input disposal and IC trap rollback. Migration cases stay within one upgrade, using a populated source mode and an empty matched upgrade to expose fixed costs without hiding whole-upgrade totals.
Native counted builds establish ID comparisons, key/value codecs, validation, projections, factories and body bytes. Provider/node/header and allocator traffic are not yet separately instrumented; ownership tests and IC page traces remain separate evidence. Counters stay out of release Wasm. Canonical IC builds measure full replicated instructions, included page charges, cycles, returned/completed work, memory and artifact size. Keep every baseline, failed attempt and source/build receipt in fresh directories.
Optimization order
First make the reference oracle and coverage ledger agree and record the unoptimized baseline. Then rank actual gaps. Initial candidates are repeated primary resolution, key scans decoding values, graph machinery on unrelated deletes, repeated Minima directory/slot work, unique-index representation, and sorted migration construction. Promote only changes with measured benefit and simple ownership/error proofs. SDK additions should preserve existing consumer paths; qualify relevant SDK runtime changes with separate matched RRT/RRts controls. No journals, background repair or migration continuation messages.