Dotted projections decode large sibling values they never return

perfloop-oss/helix-db · Late Filtering

https://perfloop.ai/t/oss/case_3zbvaz22w2

Verdict

VERIFIED · settled 2026-11-15 · pull request opened as HelixDB/helix-db#1324

What happened: The paired measurements met the required improvement.

Hypothesis

Native Values queries that select nested scalars still materialize their parent objects. Large sibling strings, arrays and maps are then discarded. This creates removable decoding and allocation work, but its contribution to complete-query cost and its production frequency remain unmeasured.

At revision 26c3f138, project_values uses a batch resolver, so ordinary record reads and validation are already shared. RowValueResolver::element_property calls property_value for stored fields and endpoint-node fields. If an exact stored name does not match, nested_property_value at property.rs:537-561 calls row.value on the first path segment. That deserializes the entire parent value before the code removes successive object members. Separate selected paths repeat this work. Exact stored dotted names do not take this fallback.

The successful instrumented command `cargo test -p db --lib perfloop_projection_probe -- --nocapture --test-threads=1` is retained in measurement receipt call_Oqq4P3MyJrFXyJzwibat59oY, output:1. For 16 directly seeded records, each with two selected nested scalars and one unrelated 65,536-byte sibling string, it observed 16 record validations, 32 parent-value deserializations and 2,097,152 deserialized string-payload bytes. These are mechanism counters, not CPU time or total allocator bytes. A provisional comparator read both scalar leaves directly from one validated archived object and matched their values without deserializing the parent.

Nested paths are a supported operation in docs/database/helix-db/core-concepts/data-model.mdx:48-58. The landed in-place resolver change, https://github.com/HelixDB/helix-db/commit/8ededbd4feea640ec5e4ee69d9d5a7a35c65fd31, already removes full top-level row decoding; this proposal addresses its remaining nested-object fallback, not that existing improvement. The current open-PR review found no owner of this delta; PR https://github.com/HelixDB/helix-db/pull/1068 changes numeric index-string encoding instead. README links Discord, but the public invite read was refused and no searchable off-host review archive was established. That is an upstream-coverage gap.

The smallest useful Case check is a provisional archive-walking fallback compared with complete native Values queries and the existing full-decoder oracle. Check exact dotted names, duplicate root names, non-object intermediates, absent paths, corruption and alignment. Removing sibling materialization while preserving results and validation confirms the local mechanism; CPU and allocation measurements must decide whether it improves the consumer operation after storage, validation and output construction are included.

Change to test: Resolve dotted selections inside the validated stored object and deserialize only the selected leaf. Preserve full-record validation, exact-name precedence, missing-field behavior and lazy record-loading contracts.

Where it lives

perfloop-oss/helix-db · crates/db/src/execution/interpreter/stream/projection/dispatch.rs

Evidence

Nested Values on property-path fixture · 14 sample pairs

metric baseline candidate paired median change confidence range required result
cpu_ns/query 78250 69750 −9.9% (−7750) −12500 to −5500 loss ≤ 0.05 × |baseline median| PASSED
elapsed_ns/query 81234 72596 −10.1% (−8174) −12573 to −5965 loss ≤ 0.05 × |baseline median| PASSED
allocated_bytes/query 217424 176432 −18.9% (−40992) −40992 to −40992 gain > 0; gain > 0.05 × |baseline median|; arm medians separated PASSED
allocations/query 969 793 −18.2% (−176) −176 to −176 loss ≤ 0.05 × |baseline median| PASSED

Nested Values with large siblings · 14 sample pairs

metric baseline candidate paired median change confidence range required result
cpu_ns/query 1112500 156250 −85.4% (−950000) −1012500 to −912500 gain > 0; gain > 0.05 × |baseline median|; arm medians separated PASSED
elapsed_ns/query 1154859 160045 −85.8% (−990671) −1057136 to −958254 loss ≤ 0.05 × |baseline median| PASSED
allocated_bytes/query 3592784 176432 −95.1% (−3416352) −3416352 to −3416352 loss ≤ 0.05 × |baseline median| PASSED
allocations/query 5545 793 −85.7% (−4752) −4752 to −4752 loss ≤ 0.05 × |baseline median| PASSED

Single-field nested Values · 25 sample pairs

metric baseline candidate paired median change confidence range required result
cpu_ns/query 13300 13000 −300 −900 to +200 loss ≤ 0.05 × |baseline median| PASSED
elapsed_ns/query 13766 13520 −291.9 −894.1 to +219.8 loss ≤ 0.05 × |baseline median| PASSED
allocated_bytes/query 58214 57577 −1.1% (−637) −637 to −637 loss ≤ 0.05 × |baseline median| PASSED
allocations/query 176 174 −1.1% (−2) −2 to −2 loss ≤ 0.05 × |baseline median| PASSED

Empty-object Values · 33 sample pairs

metric baseline candidate paired median change confidence range required result
cpu_ns/query 13000 12900 −100 −200 to +500 loss ≤ 0.05 × |baseline median| PASSED
elapsed_ns/query 13506 13361 −30.33 −295.8 to +565.4 loss ≤ 0.05 × |baseline median| PASSED
allocated_bytes/query 56125 56125 0 0 to 0 loss ≤ 0.05 × |baseline median| PASSED
allocations/query 168 168 0 0 to 0 loss ≤ 0.05 × |baseline median| PASSED

Missing nested Values · 15 sample pairs

metric baseline candidate paired median change confidence range required result
cpu_ns/query 13200 13000 −200 −1000 to +400 loss ≤ 0.05 × |baseline median| PASSED
elapsed_ns/query 13756 13505 −155 −1003 to +444.3 loss ≤ 0.05 × |baseline median| PASSED
allocated_bytes/query 57409 56125 −2.2% (−1284) −1284 to −1284 loss ≤ 0.05 × |baseline median| PASSED
allocations/query 174 168 −3.4% (−6) −6 to −6 loss ≤ 0.05 × |baseline median| PASSED

Checks: 5 of 5 passed. Verification: no defect found.

Timeline