Skip to content

Commit

Permalink
short benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
mazrean committed Mar 5, 2024
1 parent f1d1e86 commit 6a335f5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
mkdir -p ./profile
{
echo "stdout<<EOF"
go test -benchmem -bench . -cpuprofile ./profile/cpu.out -memprofile ./profile/mem.out
go test -short -benchmem -bench . -cpuprofile ./profile/cpu.out -memprofile ./profile/mem.out
echo "EOF"
} >> $GITHUB_OUTPUT
id: bench
Expand Down
18 changes: 18 additions & 0 deletions formstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,15 @@ func BenchmarkFormStreamFastPath(b *testing.B) {
benchmarkFormStream(b, 1*formstream.GB, false)
})
b.Run("5GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 5*formstream.GB, false)
})
b.Run("10GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 10*formstream.GB, false)
})
}
Expand All @@ -170,9 +176,15 @@ func BenchmarkFormStreamSlowPath(b *testing.B) {
benchmarkFormStream(b, 1*formstream.GB, true)
})
b.Run("5GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 5*formstream.GB, true)
})
b.Run("10GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 10*formstream.GB, true)
})
}
Expand Down Expand Up @@ -231,9 +243,15 @@ func BenchmarkStdMultipartReadForm(b *testing.B) {
benchmarkStdMultipartReadForm(b, 1*formstream.GB)
})
b.Run("5GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkStdMultipartReadForm(b, 5*formstream.GB)
})
b.Run("10GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkStdMultipartReadForm(b, 10*formstream.GB)
})
}
Expand Down
21 changes: 21 additions & 0 deletions http/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,15 @@ func BenchmarkFormStreamFastPath(b *testing.B) {
benchmarkFormStream(b, 1*formstream.GB, false)
})
b.Run("5GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 5*formstream.GB, false)
})
b.Run("10GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 10*formstream.GB, false)
})
}
Expand All @@ -290,9 +296,15 @@ func BenchmarkFormStreamSlowPath(b *testing.B) {
benchmarkFormStream(b, 1*formstream.GB, true)
})
b.Run("5GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 5*formstream.GB, true)
})
b.Run("10GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkFormStream(b, 10*formstream.GB, true)
})
}
Expand Down Expand Up @@ -371,8 +383,17 @@ func BenchmarkStdMultipartReadForm(b *testing.B) {
benchmarkStdMultipartReadForm(b, 1*formstream.GB)
})
b.Run("5GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkStdMultipartReadForm(b, 5*formstream.GB)
})
b.Run("10GB", func(b *testing.B) {
if testing.Short() {
b.Skip("skipping test in short mode.")
}
benchmarkStdMultipartReadForm(b, 10*formstream.GB)
})
}

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

0 comments on commit 6a335f5

Please sign in to comment.