From 68cdc29a0b5081ec3758e8f9e483ed0140dbc1e3 Mon Sep 17 00:00:00 2001 From: Andy Fan Date: Fri, 12 Apr 2024 11:22:50 -0500 Subject: [PATCH] add benchmark for bitWriter WriteVlqInt() --- go/parquet/internal/utils/bit_reader_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/go/parquet/internal/utils/bit_reader_test.go b/go/parquet/internal/utils/bit_reader_test.go index 32c26744406c7..91202979520ef 100644 --- a/go/parquet/internal/utils/bit_reader_test.go +++ b/go/parquet/internal/utils/bit_reader_test.go @@ -70,6 +70,14 @@ func TestBitWriter(t *testing.T) { assert.Equal(t, byte(2), buf[4]) } +func BenchmarkBitWriter(b *testing.B) { + buf := make([]byte, b.N) + bw := utils.NewBitWriter(utils.NewWriterAtBuffer(buf)) + for i := 0; i < b.N; i++ { + assert.True(b, bw.WriteVlqInt(uint64(1))) + } +} + func TestBitReader(t *testing.T) { buf := []byte{0xAA, 0xCC} // 0b10101010 0b11001100