perf(lidar): avoid duplicate replay decode during build

This commit is contained in:
DCCONSTRUCTIONS
2026-08-31 18:35:12 +03:00
parent f64fbb1fa6
commit 73a7d28065
2 changed files with 56 additions and 7 deletions
+26 -7
View File
@@ -398,12 +398,16 @@ def build_lidar_replay_pack_v2(
pose_coverage_threshold_ms=pose_coverage_threshold_ms,
)
_write_json(staging / LIDAR_QUALITY_REPORT_NAME, quality)
equivalence = _equivalence_report(
pack_id,
logical_sha256,
source,
arrays,
)
persisted_arrays = _MaterializedNpz(arrays_path)
try:
equivalence = _equivalence_report_from_arrays(
pack_id,
logical_sha256,
arrays,
persisted_arrays,
)
finally:
persisted_arrays.close()
_write_json(staging / LIDAR_EQUIVALENCE_REPORT_NAME, equivalence)
artifacts = [
_artifact_descriptor("lidar-arrays", arrays_path, "application/x-npz"),
@@ -816,7 +820,22 @@ def _equivalence_report(
capture_path: Path,
replay_arrays: Any,
) -> dict[str, object]:
source_arrays = _capture_arrays(capture_path)
return _equivalence_report_from_arrays(
pack_id,
logical_sha256,
_capture_arrays(capture_path),
replay_arrays,
)
def _equivalence_report_from_arrays(
pack_id: str,
logical_sha256: str,
source_arrays: Any,
replay_arrays: Any,
) -> dict[str, object]:
"""Compare one source-derived array set with its persisted replay image."""
comparisons: dict[str, dict[str, object]] = {}
mismatch_count = 0
for name in sorted(_ARRAY_DTYPES):