# Expose batch metrics in benchmark summaries

`c3b7fa0`→[main](/content/gh/entireio/git-sync/commits/main/index.html)·  
  
Soph·3mo ago·4 files·+59 added/-3 removed

## Sessions

e2a6e30a7370View transcript

## Changes

4

- cmd/git-sync-bench
  
  - Mmain.go+42/-2
  
  - Mmain\_test.go+14/-1

- docs
  
  - Mbenchmarking.md+2
  
  - Mrewrite-issue-list.md+1

```go
37 unmodified lines

...

return summary
}
```

### aggregateSummary struct

```go
type aggregateSummary struct {
	SuccessfulRuns        int      `json:"successful_runs"`
	FailedRuns            int      `json:"failed_runs"`
	BatchedRuns           int      `json:"batched_runs"`
	MinWallMillis         int64    `json:"min_wall_millis"`
	MaxWallMillis         int64    `json:"max_wall_millis"`
	AvgWallMillis         float64  `json:"avg_wall_millis"`
	MinSyncElapsedMillis  int64    `json:"min_sync_elapsed_millis"`
	MaxSyncElapsedMillis  int64    `json:"max_sync_elapsed_millis"`
	AvgSyncElapsedMillis  float64  `json:"avg_sync_elapsed_millis"`
	MinBatchCount         int      `json:"min_batch_count,omitempty"`
	MaxBatchCount         int      `json:"max_batch_count,omitempty"`
	AvgBatchCount         float64  `json:"avg_batch_count,omitempty"`
	MinPlannedBatchCount  int      `json:"min_planned_batch_count,omitempty"`
	MaxPlannedBatchCount  int      `json:"max_planned_batch_count,omitempty"`
	AvgPlannedBatchCount  float64  `json:"avg_planned_batch_count,omitempty"`
	MaxPeakAllocBytes     uint64   `json:"max_peak_alloc_bytes"`
	MaxPeakHeapInuseBytes uint64   `json:"max_peak_heap_inuse_bytes"`
	MaxTotalAllocBytes    uint64   `json:"max_total_alloc_bytes"`
}
```

## Summary calculation logic

```go
for _, run := range runs {
	if mode := strings.TrimSpace(run.Result.RelayMode); mode != "" {
		relayModes = append(relayModes, mode)
	}
	if run.Result.Batching {
		batchedRuns++
		totalBatchCount += run.Result.BatchCount
		totalPlanned += run.Result.PlannedBatchCount
	}
}
```

### Output

```go
fmt.Printf("sync-elapsed-ms: avg=%.1f min=%d max=%d\n", report.Aggregate.AvgSyncElapsedMillis, report.Aggregate.MinSyncElapsedMillis, report.Aggregate.MaxSyncElapsedMillis)
```

## Documentation Updates

- The rewrite adds an initial commit-count heuristic and memoizes repeated equivalent probe results within a planning run.
- Successful under-limit probe packs are now cached and reused during execution, which avoids a second fetch for selected checkpoints.
- Checkpoint selection now also keeps searching within known fit/too-large probe bounds so it can choose the largest fitting checkpoint once an upper bound is known.
- The benchmark harness now also reports planned and actual batch counts across repeated runs for comparison against stable baselines.

### 15. Materialized fallback path does not scale to large repos
