test(perf): align benchmark lifecycle
- commit
- 36fe4a5b1de40bde549b04f64db7a7a13616c30f
- author
- brice · · 2026-07-11 07:14 UTC
- parent
- 8c140ad
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +6 -2
M internal/usecase/copy/snapshot_test.go +3 -0
| @@ -47,6 +47,9 @@ func TestNewSnapshotFromRowsOwnsCallerRows(t *testing.T) { | |||
| 47 | 47 | // absolute budget, which varies between Go releases. A full history-row clone | |
| 48 | 48 | // grows with row width; the immutable HistoryView allocation does not. | |
| 49 | 49 | func TestNewSnapshotAllocationIsWidthIndependent(t *testing.T) { | |
| 50 | + | if testing.Short() { | |
| 51 | + | t.Skip("skipping benchmark-driven allocation gate in short mode") | |
| 52 | + | } | |
| 50 | 53 | narrow := benchmarkNewSnapshotBytes(16) | |
| 51 | 54 | wide := benchmarkNewSnapshotBytes(512) | |
| 52 | 55 | assertWidthIndependentAllocations(t, "NewSnapshot", narrow, wide) | |
| @@ -47,6 +47,9 @@ func TestNewSnapshotFromRowsOwnsCallerRows(t *testing.T) { | |||||
| 47 | // absolute budget, which varies between Go releases. A full history-row clone | 47 | // absolute budget, which varies between Go releases. A full history-row clone | ||
| 48 | // grows with row width; the immutable HistoryView allocation does not. | 48 | // grows with row width; the immutable HistoryView allocation does not. | ||
| 49 | func TestNewSnapshotAllocationIsWidthIndependent(t *testing.T) { | 49 | func TestNewSnapshotAllocationIsWidthIndependent(t *testing.T) { | ||
| 50 | + | if testing.Short() { | |||
| 51 | + | t.Skip("skipping benchmark-driven allocation gate in short mode") | |||
| 52 | + | } | |||
| 50 | narrow := benchmarkNewSnapshotBytes(16) | 53 | narrow := benchmarkNewSnapshotBytes(16) | ||
| 51 | wide := benchmarkNewSnapshotBytes(512) | 54 | wide := benchmarkNewSnapshotBytes(512) | ||
| 52 | assertWidthIndependentAllocations(t, "NewSnapshot", narrow, wide) | 55 | assertWidthIndependentAllocations(t, "NewSnapshot", narrow, wide) | ||
M internal/usecase/daemon/performance_benchmark_test.go +0 -2
| @@ -123,12 +123,10 @@ func benchmarkDaemonLargeHistory(b *testing.B, workload string, run func(*perfor | |||
| 123 | 123 | } | |
| 124 | 124 | b.ReportAllocs() | |
| 125 | 125 | fixture.resetMetrics() | |
| 126 | - | b.ResetTimer() | |
| 127 | 126 | for b.Loop() { | |
| 128 | 127 | run(fixture) | |
| 129 | 128 | fixture.ac.ackOutputState(fixture.ac.output.next) | |
| 130 | 129 | } | |
| 131 | - | b.StopTimer() | |
| 132 | 130 | metrics := fixture.metrics() | |
| 133 | 131 | if payload := fixture.output.lastPayload(); payload != nil { | |
| 134 | 132 | if _, err := ports.UnmarshalOutput(payload); err != nil { | |
| @@ -123,12 +123,10 @@ func benchmarkDaemonLargeHistory(b *testing.B, workload string, run func(*perfor | |||||
| 123 | } | 123 | } | ||
| 124 | b.ReportAllocs() | 124 | b.ReportAllocs() | ||
| 125 | fixture.resetMetrics() | 125 | fixture.resetMetrics() | ||
| 126 | - | b.ResetTimer() | |||
| 127 | for b.Loop() { | 126 | for b.Loop() { | ||
| 128 | run(fixture) | 127 | run(fixture) | ||
| 129 | fixture.ac.ackOutputState(fixture.ac.output.next) | 128 | fixture.ac.ackOutputState(fixture.ac.output.next) | ||
| 130 | } | 129 | } | ||
| 131 | - | b.StopTimer() | |||
| 132 | metrics := fixture.metrics() | 130 | metrics := fixture.metrics() | ||
| 133 | if payload := fixture.output.lastPayload(); payload != nil { | 131 | if payload := fixture.output.lastPayload(); payload != nil { | ||
| 134 | if _, err := ports.UnmarshalOutput(payload); err != nil { | 132 | if _, err := ports.UnmarshalOutput(payload); err != nil { | ||
M internal/usecase/visualsearch/model_test.go +3 -0
| @@ -108,6 +108,9 @@ func TestVisualSearchRenderShowsInputAndLineResults(t *testing.T) { | |||
| 108 | 108 | } | |
| 109 | 109 | ||
| 110 | 110 | func TestVisualSearchCloneAllocationIsWidthIndependent(t *testing.T) { | |
| 111 | + | if testing.Short() { | |
| 112 | + | t.Skip("skipping benchmark-driven allocation gate in short mode") | |
| 113 | + | } | |
| 111 | 114 | narrow := benchmarkVisualSearchCloneBytes(16) | |
| 112 | 115 | wide := benchmarkVisualSearchCloneBytes(512) | |
| 113 | 116 | assertWidthIndependentCloneAllocations(t, narrow, wide) | |
| @@ -108,6 +108,9 @@ func TestVisualSearchRenderShowsInputAndLineResults(t *testing.T) { | |||||
| 108 | } | 108 | } | ||
| 109 | 109 | ||||
| 110 | func TestVisualSearchCloneAllocationIsWidthIndependent(t *testing.T) { | 110 | func TestVisualSearchCloneAllocationIsWidthIndependent(t *testing.T) { | ||
| 111 | + | if testing.Short() { | |||
| 112 | + | t.Skip("skipping benchmark-driven allocation gate in short mode") | |||
| 113 | + | } | |||
| 111 | narrow := benchmarkVisualSearchCloneBytes(16) | 114 | narrow := benchmarkVisualSearchCloneBytes(16) | ||
| 112 | wide := benchmarkVisualSearchCloneBytes(512) | 115 | wide := benchmarkVisualSearchCloneBytes(512) | ||
| 113 | assertWidthIndependentCloneAllocations(t, narrow, wide) | 116 | assertWidthIndependentCloneAllocations(t, narrow, wide) | ||