Skip to content

Retained-result ownership qualification ​

The candidate isolates embedded APOC and query-cache results for NOR-306 and NOR-307. NOR-310 additionally corrects live streamed property-list ownership: projections reuse the detached scoring snapshot, and no-memo streams detach at delivery through the existing structural copy owner. The additional publication workloads below qualify that correction.

Workload and measurement ​

Apple M2 Max, darwin/arm64, Go 1.27.3; GOMAXPROCS=4, GOGC=100. Test binaries were built before timing. ABBA order, three 200 ms samples per invocation, six samples per arm; medians below. No local Go tests or builds overlapped. Short microbenchmarks are workload-specific, not application throughput claims.

The cache and adjacency baselines are the first correct ownership candidate 539f78c7d, not the unsafe release implementation. Detaching returned values necessarily costs more than returning a shared reference; these measurements qualify removing avoidable work from the correction, not zero-cost isolation.

WorkloadFirst correct ns/opTuned ns/opFirst correct B/opTuned B/opFirst correct allocs/opTuned allocs/op
100-row scalar/list smart-cache hit42,51522,29556,40823,172825712
100-row entity smart-cache hit51,97541,05286,39271,1801,1231,112
64-edge degree count81,26319475,25601,6710
64-edge star, one-hop shortest path5,377,71116,1425,005,44620,456111,131194

The cache walker reuses a cleared overflow identity map (at most 1,024 recorded references), retaining no caller values between copies. Typed map/list dispatch uses the same existing traversal and alias/cycle memo. Degree counts visit metadata without materializing properties; paths detach only returned members.

The native storage copier was already correct on the release baseline bea145d518c9ae2c9df7ced456b245321cad9565. Its separate controls compare that baseline against the tuned shared owner:

Native node copyRelease ns/opTuned ns/opB/op bothallocs/op both
8 flat properties2572434964
64 flat properties1,9481,7755,1126
8 nested properties1,7561,7983,82444
64 nested properties14,06314,37031,736326

Nested controls show about 2.2–2.4% higher median time in this sample with unchanged bytes and allocations; this is not proof of identical latency.

Profiles and reproduction ​

The allocation profile attributed 57.7% of initial scalar-cache copy bytes to identity-index growth. The degree allocation profile attributed 98.4% to copying relationships that a count never returns. Darwin CPU sampling was dominated by runtime.kevent, so it does not establish precise CPU attribution.

sh
GOMAXPROCS=4 GOGC=100 go test -tags=noui,nolocalllm ./pkg/cypher \
  -run '^$' -bench '^BenchmarkNOR307QueryResultCache$' -benchmem -count=6
GOMAXPROCS=4 GOGC=100 go test -tags=noui,nolocalllm ./pkg/storage \
  -run '^$' -bench '^BenchmarkNativeEntityCallerCopy$' -benchmem -count=6
GOMAXPROCS=4 GOGC=100 go test -tags=noui,nolocalllm ./apoc/storage \
  -run '^$' -bench '^BenchmarkInMemoryStorage(DegreeMetadata|ShortestPathOwnership)$' \
  -benchmem -count=6

Use matched fixtures on both revisions, build before timing and interleave runs for comparisons. Full integrated readiness still requires passing explicit-write integration and exact-head make-test CI. These benchmark results alone are not a merge-readiness claim.

Live statement publication (NOR-310) ​

The public continuation regression uses valid string-list properties, nodes and relationships, result caching disabled, and decay on/off. The consumer changes a list in the first delivered row before pulling the remaining rows. Release bea145d51 exposes that changed value in later rows. Scoring snapshots already owned their property values; projecting those snapshots protects the memo path without another property copy. Other live streams detach at delivery, preserving map-order metadata and refusing cancellation during copying.

The following six-sample medians use the same machine and ABBA controls above. The outer result cache is explicitly disabled. repeated_property reads one hidden property 100 times; node_rows returns one node across 100 rows with the memo active; plain_stream_rows pulls 100 rows with decay off. Compared with the unsafe release, the latter must now allocate independent mutable node images.

WorkloadRelease ns/opCandidate ns/opRelease B/opCandidate B/opRelease allocs/opCandidate allocs/op
repeated_property258,341257,95528,18928,188262262
node_rows615,924628,380570,315570,3199,3539,353
plain_stream_rows78,733118,14123,36080,161346946

The final candidate column comes from the follow-up ABBA pair against the first correct copying implementation; these are separate paired samples, so small cross-pair latency differences are not precise causal attribution. Default memo workloads show unchanged allocations and effectively unchanged bytes; the node-row median is about 2% higher across these samples. The plain stream's additional retained output images are a documented correctness cost, not a claimed performance win over shared mutable references.

An allocation profile of correct plain streaming attributed 14.7% of allocation objects to the root list copier. Keeping the producer-owned single-column row buffer and detaching only its value removes that unnecessary root copy; multi-column rows still use one graph copy to preserve container aliases. In a separate direct ABBA comparison this reduced correct plain streaming from 123,623 to 118,141 ns/op, 88,961 to 80,161 B/op, and 1,346 to 946 allocs/op. No benchmark ran alongside local Go tests/builds; incomplete setup runs are excluded. CPU and allocation profiles were captured for the live publication workloads; no end-to-end ingest speed claim follows from these microbenchmarks.

sh
GOMAXPROCS=4 GOGC=100 go test -tags=noui,nolocalllm ./pkg/cypher \
  -run '^$' -bench '^BenchmarkStatementPropertyPublication$' -benchmem -count=6

The over-budget projection is covered by ownership component tests using an already constructed large read image. It is not a large persisted-payload benchmark: the in-memory Badger fixture rejects values over its 64 KiB inline limit, so the attempted oversized public fixture is excluded from results.

Analytics privacy