Skip to content

Commit 4b76afc

Browse files
committed
Add benchmark tests for parsing data frames
1 parent e2310ae commit 4b76afc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

http2/frame_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,3 +1258,20 @@ func TestSettingsDuplicates(t *testing.T) {
12581258
}
12591259

12601260
}
1261+
1262+
func BenchmarkParseDataFrames(b *testing.B) {
1263+
fr, _ := testFramer()
1264+
fr.SetReuseFrames()
1265+
payload := []byte("foo")
1266+
for i := 0; i < b.N; i++ {
1267+
parseDataFrame(fr.frameCache, FrameHeader{StreamID: 3}, func(s string) {}, payload)
1268+
}
1269+
}
1270+
1271+
func BenchmarkParseDataFramesWithoutReuse(b *testing.B) {
1272+
fr, _ := testFramer()
1273+
payload := []byte("foo")
1274+
for i := 0; i < b.N; i++ {
1275+
parseDataFrame(fr.frameCache, FrameHeader{StreamID: 3}, func(s string) {}, payload)
1276+
}
1277+
}

0 commit comments

Comments
 (0)