Commit 0104f8a
refactor: eliminate code and data duplication in precompute engine
accumulator_factory.rs:
- Add impl_clone_accumulator_methods! macro to replace 16 identical
take_accumulator/snapshot_accumulator bodies across 8 updater structs
- Add config_is_keyed() free fn for static keyed check without allocating
an updater (replaces throwaway-updater pattern used 4+ times)
- Add kll_k_param(), cms_params(), hydra_kll_params() helpers to
eliminate 4 copy-pasted parameter extraction blocks in the factory
- Fix latent bug: SingleSubpopulation/KLL arm now checks "K" (capital)
before "k", consistent with all other arms
- Add tests: test_config_is_keyed, test_kll_k_param_capital_k
worker.rs:
- AggregationState.config: AggregationConfig -> Arc<AggregationConfig>
eliminating N×M deep config copies across series×aggregations
- Worker.agg_configs and Worker::new param updated to Arc map;
matching_agg_configs returns owned Arc clones (removes lifetime tie)
- Add apply_sample() free fn replacing 3 copies of is_keyed dispatch
- Add merge_panes_for_window() free fn replacing identical ~40-line
pane-merge loop in both process_samples and flush_all
- Fix ForwardToStore path: is_keyed() and extract_key_from_series()
each called once instead of twice
engine.rs:
- Wrap aggregation configs in Arc once at engine startup; per-worker
agg_configs.clone() is now N pointer bumps, not N full deep copies
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ea737ec commit 0104f8a
3 files changed
Lines changed: 302 additions & 238 deletions
0 commit comments