perf(tests): profile statistics and occupancy fixture costs before optimization #240

Open
opened 2026-10-03 08:11:19 +00:00 by gabogg · 0 comments
Owner

Goal

Measure fixture and synthetic-data costs in the statistics and occupancy tests, then optimize only a demonstrated bottleneck without changing domain semantics. No specific saving or batching implementation is established yet.

Measured research

Source: docs/research/217-test-performance-and-agent-workflows.md (PR #218, research #217).

For the selected 19-test API/summary workload, median cumulative time over three profiles was 3.077s for init_db, 2.880s for seeding, 1.310s for authentication and 0.091s for record_event. Seeding is nested inside initialization; these rows cannot be added independently. This subset does not profile the whole suite.

The former claim that 80%+ of wall time is unbatched INSERTs and the promised 15–20s saving are withdrawn. record_event_async also updates camera counters and telemetry: inserting only event rows would lose those semantics. Closed/checkpointed template-copy measurements are candidates, not proof of suite-wide savings.

Next steps / acceptance criteria

  1. Profile the intended statistics/occupancy subset on a pinned tree, separating initialization, seeding, authentication, event recording and endpoint computation. Preserve reproducible commands, phase durations and component receipts.
  2. Choose an optimization only after identifying a material cost. Evaluate fixture reuse or consistent template snapshots where starting state is identical; batch event creation only if equivalent counter and telemetry semantics are retained.
  3. Keep per-test isolation, existing assertions and real SQLite/ASGI flows. Never copy only the main file of a live WAL database; use a consistent snapshot.
  4. Compare repeated before/after subset and full-suite runs under comparable conditions, report measured savings and run the complete suite. There is no predetermined 0.2s per-test or 15–20s suite target.

Needs triage: measurements must determine the implementation scope before this is ready for an agent.

## Goal Measure fixture and synthetic-data costs in the statistics and occupancy tests, then optimize only a demonstrated bottleneck without changing domain semantics. No specific saving or batching implementation is established yet. ## Measured research Source: [docs/research/217-test-performance-and-agent-workflows.md](https://git.gaboggamer.online/gabogg/hikcentral/src/commit/4abfff3f690b29ed075020192b4fbb492880f9b2/docs/research/217-test-performance-and-agent-workflows.md) (PR #218, research #217). For the selected 19-test API/summary workload, median cumulative time over three profiles was 3.077s for init_db, 2.880s for seeding, 1.310s for authentication and 0.091s for record_event. Seeding is nested inside initialization; these rows cannot be added independently. This subset does not profile the whole suite. The former claim that 80%+ of wall time is unbatched INSERTs and the promised 15–20s saving are withdrawn. record_event_async also updates camera counters and telemetry: inserting only event rows would lose those semantics. Closed/checkpointed template-copy measurements are candidates, not proof of suite-wide savings. ## Next steps / acceptance criteria 1. Profile the intended statistics/occupancy subset on a pinned tree, separating initialization, seeding, authentication, event recording and endpoint computation. Preserve reproducible commands, phase durations and component receipts. 2. Choose an optimization only after identifying a material cost. Evaluate fixture reuse or consistent template snapshots where starting state is identical; batch event creation only if equivalent counter and telemetry semantics are retained. 3. Keep per-test isolation, existing assertions and real SQLite/ASGI flows. Never copy only the main file of a live WAL database; use a consistent snapshot. 4. Compare repeated before/after subset and full-suite runs under comparable conditions, report measured savings and run the complete suite. There is no predetermined 0.2s per-test or 15–20s suite target. Needs triage: measurements must determine the implementation scope before this is ready for an agent.
gabogg changed title from perf(tests): batch synthetic time-series insertions in statistics test fixtures to perf(tests): profile statistics and occupancy fixture costs before optimization 2026-10-03 18:11:40 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#240
No description provided.