Exp 268: leave empty statement caches virtual - #303
Conversation
Belief impactLearned
What this changed
|
…he-init # Conflicts: # experiments/JOURNAL.md
Belief impactLearned
What this changed
|
…he-init # Conflicts: # experiments/JOURNAL.md
Hypothesis
Exp 267's 128-entry statement caches eagerly dirty unused pages during open:
stmt_cache_initclears the complete array even though the parent database allocation is already zeroed, consumers inspect only[0, count), and insertion fully initializes each slot before publishing it. Making initialization count-only should recover roughly one 273,408-byte cache per reader without changing cache behavior.Approach
stmt_cache_init; retaincount = 0.origin/mainat96e6730.Results
The candidate was lower in all 48 paired RSS observations. Optimized baseline code contains one
_bzero(..., 0x42c00)per reader; candidate code omits it. Pressure controls were neutral by median:point1−0.48%,rotate128−0.61%, andchurn-unique−0.51%.Outcome
Accepted. This recovers most of exp267's +0.8–1.2 MB pool RSS price with a deletion-sized runtime change and no new allocation, OOM, fragmentation, or ownership path. The actual cache entry is 2,136 bytes, correcting exp267's approximate 1.6 KB figure. Exact-sized dependency metadata remains open only if a representative populated-cache trace justifies it.
This PR changes native runtime code, so the automation will not merge it; it should remain open for human approval after CI and automated review are green.
Test plan
dart run benchmark/finalize_experiment.dart --experiment=experiments/268-stmt-cache-lazy-init.mddart run benchmark/check_experiment_dispositions.dartdart run benchmark/check_knowledge_links.dartdart run benchmark/generate_knowledge_page.dart --checkdart analyze --fatal-infosdart test -j 1(394 tests)point1,rotate128,churn-uniquegit diff --check