Skip to content

Commit 6a335f5

Browse files
committed
short benchmark
1 parent f1d1e86 commit 6a335f5

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

.github/workflows/benchmark.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
mkdir -p ./profile
2121
{
2222
echo "stdout<<EOF"
23-
go test -benchmem -bench . -cpuprofile ./profile/cpu.out -memprofile ./profile/mem.out
23+
go test -short -benchmem -bench . -cpuprofile ./profile/cpu.out -memprofile ./profile/mem.out
2424
echo "EOF"
2525
} >> $GITHUB_OUTPUT
2626
id: bench

formstream_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,15 @@ func BenchmarkFormStreamFastPath(b *testing.B) {
149149
benchmarkFormStream(b, 1*formstream.GB, false)
150150
})
151151
b.Run("5GB", func(b *testing.B) {
152+
if testing.Short() {
153+
b.Skip("skipping test in short mode.")
154+
}
152155
benchmarkFormStream(b, 5*formstream.GB, false)
153156
})
154157
b.Run("10GB", func(b *testing.B) {
158+
if testing.Short() {
159+
b.Skip("skipping test in short mode.")
160+
}
155161
benchmarkFormStream(b, 10*formstream.GB, false)
156162
})
157163
}
@@ -170,9 +176,15 @@ func BenchmarkFormStreamSlowPath(b *testing.B) {
170176
benchmarkFormStream(b, 1*formstream.GB, true)
171177
})
172178
b.Run("5GB", func(b *testing.B) {
179+
if testing.Short() {
180+
b.Skip("skipping test in short mode.")
181+
}
173182
benchmarkFormStream(b, 5*formstream.GB, true)
174183
})
175184
b.Run("10GB", func(b *testing.B) {
185+
if testing.Short() {
186+
b.Skip("skipping test in short mode.")
187+
}
176188
benchmarkFormStream(b, 10*formstream.GB, true)
177189
})
178190
}
@@ -231,9 +243,15 @@ func BenchmarkStdMultipartReadForm(b *testing.B) {
231243
benchmarkStdMultipartReadForm(b, 1*formstream.GB)
232244
})
233245
b.Run("5GB", func(b *testing.B) {
246+
if testing.Short() {
247+
b.Skip("skipping test in short mode.")
248+
}
234249
benchmarkStdMultipartReadForm(b, 5*formstream.GB)
235250
})
236251
b.Run("10GB", func(b *testing.B) {
252+
if testing.Short() {
253+
b.Skip("skipping test in short mode.")
254+
}
237255
benchmarkStdMultipartReadForm(b, 10*formstream.GB)
238256
})
239257
}

http/parser_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,15 @@ func BenchmarkFormStreamFastPath(b *testing.B) {
269269
benchmarkFormStream(b, 1*formstream.GB, false)
270270
})
271271
b.Run("5GB", func(b *testing.B) {
272+
if testing.Short() {
273+
b.Skip("skipping test in short mode.")
274+
}
272275
benchmarkFormStream(b, 5*formstream.GB, false)
273276
})
274277
b.Run("10GB", func(b *testing.B) {
278+
if testing.Short() {
279+
b.Skip("skipping test in short mode.")
280+
}
275281
benchmarkFormStream(b, 10*formstream.GB, false)
276282
})
277283
}
@@ -290,9 +296,15 @@ func BenchmarkFormStreamSlowPath(b *testing.B) {
290296
benchmarkFormStream(b, 1*formstream.GB, true)
291297
})
292298
b.Run("5GB", func(b *testing.B) {
299+
if testing.Short() {
300+
b.Skip("skipping test in short mode.")
301+
}
293302
benchmarkFormStream(b, 5*formstream.GB, true)
294303
})
295304
b.Run("10GB", func(b *testing.B) {
305+
if testing.Short() {
306+
b.Skip("skipping test in short mode.")
307+
}
296308
benchmarkFormStream(b, 10*formstream.GB, true)
297309
})
298310
}
@@ -371,8 +383,17 @@ func BenchmarkStdMultipartReadForm(b *testing.B) {
371383
benchmarkStdMultipartReadForm(b, 1*formstream.GB)
372384
})
373385
b.Run("5GB", func(b *testing.B) {
386+
if testing.Short() {
387+
b.Skip("skipping test in short mode.")
388+
}
374389
benchmarkStdMultipartReadForm(b, 5*formstream.GB)
375390
})
391+
b.Run("10GB", func(b *testing.B) {
392+
if testing.Short() {
393+
b.Skip("skipping test in short mode.")
394+
}
395+
benchmarkStdMultipartReadForm(b, 10*formstream.GB)
396+
})
376397
}
377398

378399
func benchmarkStdMultipartReadForm(b *testing.B, fileSize formstream.DataSize) {

0 commit comments

Comments
 (0)