From 62029dff981951ad47b9f6189d6be9e368a8a9e4 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 12:06:48 +0300 Subject: [PATCH 01/12] add benchmark for CRI decoder --- decoder/cri_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/decoder/cri_test.go b/decoder/cri_test.go index 1266914f2..11816d746 100644 --- a/decoder/cri_test.go +++ b/decoder/cri_test.go @@ -57,3 +57,9 @@ func TestCRIJoined3Lines(t *testing.T) { assert.Equal(t, `{"level":"warn","ts":"2024-05-22T06:39:29.230Z"}\n`, string(row.Log)) assert.Equal(t, false, row.IsPartial) } + +func BenchmarkCRI(b *testing.B) { + for b.Loop() { + _, _ = DecodeCRI([]byte("2016-10-06T00:17:09.669794202Z stdout P partial content 1\n")) + } +} From 5e312a787a83da1c91fb0bbfcb0cc147786947bb Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 12:06:48 +0300 Subject: [PATCH 02/12] add benchmark for CRI decoder --- decoder/cri_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/decoder/cri_test.go b/decoder/cri_test.go index 1266914f2..1831e0144 100644 --- a/decoder/cri_test.go +++ b/decoder/cri_test.go @@ -57,3 +57,9 @@ func TestCRIJoined3Lines(t *testing.T) { assert.Equal(t, `{"level":"warn","ts":"2024-05-22T06:39:29.230Z"}\n`, string(row.Log)) assert.Equal(t, false, row.IsPartial) } + +func BenchmarkDecodeCRI(b *testing.B) { + for b.Loop() { + _, _ = DecodeCRI([]byte("2016-10-06T00:17:09.669794202Z stdout P partial content 1\n")) + } +} From 8e66c92998b616966a0934ce5b6986560108a7c3 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 13:10:43 +0300 Subject: [PATCH 03/12] add benchmarks for CSV decoder --- decoder/csv_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/decoder/csv_test.go b/decoder/csv_test.go index ee1afc365..ca725b9bf 100644 --- a/decoder/csv_test.go +++ b/decoder/csv_test.go @@ -181,3 +181,22 @@ func TestDecodeToJsonCSV(t *testing.T) { }) } } + +func BenchmarkDecodeCSV(b *testing.B) { + d, _ := NewCSVDecoder(make(map[string]any)) + + for b.Loop() { + _, _ = d.Decode([]byte(`a,b,c`)) + } +} + +func BenchmarkDecodeToJsonCSV(b *testing.B) { + d, _ := NewCSVDecoder(make(map[string]any)) + + root := insaneJSON.Spawn() + defer insaneJSON.Release(root) + + for b.Loop() { + _ = d.DecodeToJson(root, []byte(`a,b,c`)) + } +} From cd4e4487ce13776877887fffeabb83ed4d06ab44 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 13:33:56 +0300 Subject: [PATCH 04/12] add benchmarks for Nginx decoder --- decoder/nginx_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/decoder/nginx_test.go b/decoder/nginx_test.go index eb9d2b751..cc576495f 100644 --- a/decoder/nginx_test.go +++ b/decoder/nginx_test.go @@ -153,3 +153,13 @@ func TestNginxError(t *testing.T) { }) } } + +func BenchmarkDecode(b *testing.B) { + const input = `2022/08/18 09:29:37 [error] 844935#844935: *44934601 upstream timed out (110: Operation timed out) while connecting to upstream, client: 10.125.172.251, server: mpm-youtube-downloader-38.name.tldn, request: "POST /download HTTP/1.1", upstream: "http://10.117.246.15:84/download", host: "mpm-youtube-downloader-38.name.tldn:84"` + "\n" + + d, _ := NewNginxErrorDecoder(nil) + + for b.Loop() { + _, _ = d.Decode([]byte(input)) + } +} From f865f7574f6fb4cbd4e15f2d23f48a329bfd8f77 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 13:37:24 +0300 Subject: [PATCH 05/12] add benchmarks for postgres decoder --- decoder/postgres_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/decoder/postgres_test.go b/decoder/postgres_test.go index 6b1ad02df..cf1f7be12 100644 --- a/decoder/postgres_test.go +++ b/decoder/postgres_test.go @@ -22,3 +22,12 @@ func TestPostgres(t *testing.T) { assert.Equal(t, "test_user", root.Dig("user").AsString()) assert.Equal(t, "listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\n", root.Dig("log").AsString()) } + +func BenchmarkDecodePostgresToJson(b *testing.B) { + root := insaneJSON.Spawn() + defer insaneJSON.Release(root) + + for b.Loop() { + _ = DecodePostgresToJson(root, []byte("2021-06-22 16:24:27 GMT [7291] => [3-1] client=test_client,db=test_db,user=test_user LOG: listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\n")) + } +} From ea8f61fb2202699dfa655271a9b13890088910ac Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 14:09:57 +0300 Subject: [PATCH 06/12] add benchmarks for protobuf decoder --- decoder/protobuf_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/decoder/protobuf_test.go b/decoder/protobuf_test.go index 2a3e024a3..f96813aed 100644 --- a/decoder/protobuf_test.go +++ b/decoder/protobuf_test.go @@ -188,3 +188,26 @@ func TestProtobuf(t *testing.T) { }) } } + +func BenchmarkDecodeToJson(b *testing.B) { + const protoMessage = "MyMessage" + + inputData := []byte{10, 13, 10, 9, 109, 121, 95, 115, 116, 114, 105, 110, 103, 16, 123, 18, 14, 10, 4, 115, 116, 114, 49, 10, 4, 115, 116, 114, 50, 16, 1, 24, 10} + + p := map[string]any{ + protoFileParam: "with_imports.proto", + protoMessageParam: protoMessage, + protoImportPathsParam: []any{ + "../testdata/proto", + }, + } + + dec, _ := NewProtobufDecoder(p) + + root := insaneJSON.Spawn() + defer insaneJSON.Release(root) + + for b.Loop() { + _ = dec.DecodeToJson(root, inputData) + } +} From f75024fd823bc1808e1ed52e14a1a01a195eb8d1 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 14:17:19 +0300 Subject: [PATCH 07/12] add benchmarks for SyslogRFC3164 decoder --- decoder/syslog_rfc3164_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/decoder/syslog_rfc3164_test.go b/decoder/syslog_rfc3164_test.go index ba9d29b4f..ea1a4e17d 100644 --- a/decoder/syslog_rfc3164_test.go +++ b/decoder/syslog_rfc3164_test.go @@ -164,3 +164,13 @@ func TestSyslogRFC3164(t *testing.T) { }) } } + +func BenchmarkSyslogRFC3164Decoder(b *testing.B) { + const input = "<34>Oct 11 22:14:15 mymachine.example.com myproc[10]: 'myproc' failed on /dev/pts/8\n" + + d, _ := NewSyslogRFC3164Decoder(nil) + + for b.Loop() { + _, _ = d.Decode([]byte(input)) + } +} From c62bbd77694cca15a7de86689feb6473e739cec2 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 14:20:43 +0300 Subject: [PATCH 08/12] add benchmarks for SyslogRFC5424 decoder --- decoder/syslog_rfc5424_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/decoder/syslog_rfc5424_test.go b/decoder/syslog_rfc5424_test.go index 96c68d0fe..e6e69970d 100644 --- a/decoder/syslog_rfc5424_test.go +++ b/decoder/syslog_rfc5424_test.go @@ -482,3 +482,13 @@ func TestSyslogRFC5424(t *testing.T) { }) } } + +func BenchmarkSyslogRFC5424(b *testing.B) { + const input = "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com myproc 10 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"My \\\"Application\\\"\" eventID=\"1011\"] An application event log\n" + + d, _ := NewSyslogRFC5424Decoder(nil) + + for b.Loop() { + _, _ = d.Decode([]byte(input)) + } +} From 2239543416accc5c82b028da53939c0960c098c7 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 14:45:46 +0300 Subject: [PATCH 09/12] banchmarks refactored --- decoder/csv_test.go | 4 ++-- decoder/nginx_test.go | 2 +- decoder/protobuf_test.go | 2 +- decoder/syslog_rfc3164_test.go | 2 +- decoder/syslog_rfc5424_test.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/decoder/csv_test.go b/decoder/csv_test.go index ca725b9bf..8f44fa319 100644 --- a/decoder/csv_test.go +++ b/decoder/csv_test.go @@ -182,7 +182,7 @@ func TestDecodeToJsonCSV(t *testing.T) { } } -func BenchmarkDecodeCSV(b *testing.B) { +func BenchmarkDecodeCSV_Decode(b *testing.B) { d, _ := NewCSVDecoder(make(map[string]any)) for b.Loop() { @@ -190,7 +190,7 @@ func BenchmarkDecodeCSV(b *testing.B) { } } -func BenchmarkDecodeToJsonCSV(b *testing.B) { +func BenchmarkCSVDecoder_DecodeToJsonCSV(b *testing.B) { d, _ := NewCSVDecoder(make(map[string]any)) root := insaneJSON.Spawn() diff --git a/decoder/nginx_test.go b/decoder/nginx_test.go index cc576495f..327179293 100644 --- a/decoder/nginx_test.go +++ b/decoder/nginx_test.go @@ -154,7 +154,7 @@ func TestNginxError(t *testing.T) { } } -func BenchmarkDecode(b *testing.B) { +func BenchmarkNginxErrorDecoder_Decode(b *testing.B) { const input = `2022/08/18 09:29:37 [error] 844935#844935: *44934601 upstream timed out (110: Operation timed out) while connecting to upstream, client: 10.125.172.251, server: mpm-youtube-downloader-38.name.tldn, request: "POST /download HTTP/1.1", upstream: "http://10.117.246.15:84/download", host: "mpm-youtube-downloader-38.name.tldn:84"` + "\n" d, _ := NewNginxErrorDecoder(nil) diff --git a/decoder/protobuf_test.go b/decoder/protobuf_test.go index f96813aed..a1f4e19e7 100644 --- a/decoder/protobuf_test.go +++ b/decoder/protobuf_test.go @@ -189,7 +189,7 @@ func TestProtobuf(t *testing.T) { } } -func BenchmarkDecodeToJson(b *testing.B) { +func BenchmarkProtobufDecoder_DecodeToJson(b *testing.B) { const protoMessage = "MyMessage" inputData := []byte{10, 13, 10, 9, 109, 121, 95, 115, 116, 114, 105, 110, 103, 16, 123, 18, 14, 10, 4, 115, 116, 114, 49, 10, 4, 115, 116, 114, 50, 16, 1, 24, 10} diff --git a/decoder/syslog_rfc3164_test.go b/decoder/syslog_rfc3164_test.go index ea1a4e17d..8bce94be5 100644 --- a/decoder/syslog_rfc3164_test.go +++ b/decoder/syslog_rfc3164_test.go @@ -165,7 +165,7 @@ func TestSyslogRFC3164(t *testing.T) { } } -func BenchmarkSyslogRFC3164Decoder(b *testing.B) { +func BenchmarkSyslogRFC3164Decoder_Decode(b *testing.B) { const input = "<34>Oct 11 22:14:15 mymachine.example.com myproc[10]: 'myproc' failed on /dev/pts/8\n" d, _ := NewSyslogRFC3164Decoder(nil) diff --git a/decoder/syslog_rfc5424_test.go b/decoder/syslog_rfc5424_test.go index e6e69970d..48eca6392 100644 --- a/decoder/syslog_rfc5424_test.go +++ b/decoder/syslog_rfc5424_test.go @@ -483,7 +483,7 @@ func TestSyslogRFC5424(t *testing.T) { } } -func BenchmarkSyslogRFC5424(b *testing.B) { +func BenchmarkSyslogRFC5424_Decode(b *testing.B) { const input = "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com myproc 10 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"My \\\"Application\\\"\" eventID=\"1011\"] An application event log\n" d, _ := NewSyslogRFC5424Decoder(nil) From 39dd3dc7172c82124e49939f82db1236729e398a Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 14:54:34 +0300 Subject: [PATCH 10/12] add benchmarks for [Nginx.ErrorDecoder.DecodeToJson] --- decoder/nginx_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/decoder/nginx_test.go b/decoder/nginx_test.go index 327179293..92939c761 100644 --- a/decoder/nginx_test.go +++ b/decoder/nginx_test.go @@ -3,6 +3,7 @@ package decoder import ( "testing" + insaneJSON "github.com/ozontech/insane-json" "github.com/stretchr/testify/assert" ) @@ -163,3 +164,16 @@ func BenchmarkNginxErrorDecoder_Decode(b *testing.B) { _, _ = d.Decode([]byte(input)) } } + +func BenchmarkNginxErrorDecoder_DecodeToJson(b *testing.B) { + const input = `2022/08/18 09:29:37 [error] 844935#844935: *44934601 upstream timed out (110: Operation timed out) while connecting to upstream, client: 10.125.172.251, server: mpm-youtube-downloader-38.name.tldn, request: "POST /download HTTP/1.1", upstream: "http://10.117.246.15:84/download", host: "mpm-youtube-downloader-38.name.tldn:84"` + "\n" + + d, _ := NewNginxErrorDecoder(nil) + + root := insaneJSON.Spawn() + defer insaneJSON.Release(root) + + for b.Loop() { + _ = d.DecodeToJson(root, []byte(input)) + } +} From af70380eeb2ea72213d12591beba65e69c72d991 Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Mon, 3 Nov 2025 14:59:39 +0300 Subject: [PATCH 11/12] benchmarks extended --- decoder/protobuf_test.go | 20 ++++++++++++++++++++ decoder/syslog_rfc3164_test.go | 14 ++++++++++++++ decoder/syslog_rfc5424_test.go | 14 ++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/decoder/protobuf_test.go b/decoder/protobuf_test.go index a1f4e19e7..f2a1f2d33 100644 --- a/decoder/protobuf_test.go +++ b/decoder/protobuf_test.go @@ -189,6 +189,26 @@ func TestProtobuf(t *testing.T) { } } +func BenchmarkProtobufDecoder_Decode(b *testing.B) { + const protoMessage = "MyMessage" + + inputData := []byte{10, 13, 10, 9, 109, 121, 95, 115, 116, 114, 105, 110, 103, 16, 123, 18, 14, 10, 4, 115, 116, 114, 49, 10, 4, 115, 116, 114, 50, 16, 1, 24, 10} + + p := map[string]any{ + protoFileParam: "with_imports.proto", + protoMessageParam: protoMessage, + protoImportPathsParam: []any{ + "../testdata/proto", + }, + } + + dec, _ := NewProtobufDecoder(p) + + for b.Loop() { + _, _ = dec.Decode(inputData) + } +} + func BenchmarkProtobufDecoder_DecodeToJson(b *testing.B) { const protoMessage = "MyMessage" diff --git a/decoder/syslog_rfc3164_test.go b/decoder/syslog_rfc3164_test.go index 8bce94be5..584733ac6 100644 --- a/decoder/syslog_rfc3164_test.go +++ b/decoder/syslog_rfc3164_test.go @@ -3,6 +3,7 @@ package decoder import ( "testing" + insaneJSON "github.com/ozontech/insane-json" "github.com/stretchr/testify/assert" ) @@ -174,3 +175,16 @@ func BenchmarkSyslogRFC3164Decoder_Decode(b *testing.B) { _, _ = d.Decode([]byte(input)) } } + +func BenchmarkSyslogRFC3164Decoder_DecodeToJson(b *testing.B) { + const input = "<34>Oct 11 22:14:15 mymachine.example.com myproc[10]: 'myproc' failed on /dev/pts/8\n" + + d, _ := NewSyslogRFC3164Decoder(nil) + + root := insaneJSON.Spawn() + defer insaneJSON.Release(root) + + for b.Loop() { + _ = d.DecodeToJson(root, []byte(input)) + } +} diff --git a/decoder/syslog_rfc5424_test.go b/decoder/syslog_rfc5424_test.go index 48eca6392..bc4a6c38c 100644 --- a/decoder/syslog_rfc5424_test.go +++ b/decoder/syslog_rfc5424_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + insaneJSON "github.com/ozontech/insane-json" "github.com/stretchr/testify/assert" ) @@ -492,3 +493,16 @@ func BenchmarkSyslogRFC5424_Decode(b *testing.B) { _, _ = d.Decode([]byte(input)) } } + +func BenchmarkSyslogRFC5424_DecodeToJson(b *testing.B) { + const input = "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com myproc 10 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"My \\\"Application\\\"\" eventID=\"1011\"] An application event log\n" + + d, _ := NewSyslogRFC5424Decoder(nil) + + root := insaneJSON.Spawn() + defer insaneJSON.Release(root) + + for b.Loop() { + _ = d.DecodeToJson(root, []byte(input)) + } +} From 40d08ffe54e9249a527c2f811359a52969a9934c Mon Sep 17 00:00:00 2001 From: Banana Duck Date: Fri, 7 Nov 2025 11:32:55 +0300 Subject: [PATCH 12/12] refactor decoder benchmarks & remove '*DecodeToJson' benchmarks --- decoder/csv_test.go | 13 +------------ decoder/nginx_test.go | 16 +--------------- decoder/postgres_test.go | 7 ++----- decoder/protobuf_test.go | 25 +------------------------ decoder/syslog_rfc3164_test.go | 16 +--------------- decoder/syslog_rfc5424_test.go | 16 +--------------- 6 files changed, 7 insertions(+), 86 deletions(-) diff --git a/decoder/csv_test.go b/decoder/csv_test.go index 8f44fa319..1a9b1ee32 100644 --- a/decoder/csv_test.go +++ b/decoder/csv_test.go @@ -182,21 +182,10 @@ func TestDecodeToJsonCSV(t *testing.T) { } } -func BenchmarkDecodeCSV_Decode(b *testing.B) { +func BenchmarkDecodeCSV(b *testing.B) { d, _ := NewCSVDecoder(make(map[string]any)) for b.Loop() { _, _ = d.Decode([]byte(`a,b,c`)) } } - -func BenchmarkCSVDecoder_DecodeToJsonCSV(b *testing.B) { - d, _ := NewCSVDecoder(make(map[string]any)) - - root := insaneJSON.Spawn() - defer insaneJSON.Release(root) - - for b.Loop() { - _ = d.DecodeToJson(root, []byte(`a,b,c`)) - } -} diff --git a/decoder/nginx_test.go b/decoder/nginx_test.go index 92939c761..f43cfd5bd 100644 --- a/decoder/nginx_test.go +++ b/decoder/nginx_test.go @@ -3,7 +3,6 @@ package decoder import ( "testing" - insaneJSON "github.com/ozontech/insane-json" "github.com/stretchr/testify/assert" ) @@ -155,7 +154,7 @@ func TestNginxError(t *testing.T) { } } -func BenchmarkNginxErrorDecoder_Decode(b *testing.B) { +func BenchmarkDecodeNginx(b *testing.B) { const input = `2022/08/18 09:29:37 [error] 844935#844935: *44934601 upstream timed out (110: Operation timed out) while connecting to upstream, client: 10.125.172.251, server: mpm-youtube-downloader-38.name.tldn, request: "POST /download HTTP/1.1", upstream: "http://10.117.246.15:84/download", host: "mpm-youtube-downloader-38.name.tldn:84"` + "\n" d, _ := NewNginxErrorDecoder(nil) @@ -164,16 +163,3 @@ func BenchmarkNginxErrorDecoder_Decode(b *testing.B) { _, _ = d.Decode([]byte(input)) } } - -func BenchmarkNginxErrorDecoder_DecodeToJson(b *testing.B) { - const input = `2022/08/18 09:29:37 [error] 844935#844935: *44934601 upstream timed out (110: Operation timed out) while connecting to upstream, client: 10.125.172.251, server: mpm-youtube-downloader-38.name.tldn, request: "POST /download HTTP/1.1", upstream: "http://10.117.246.15:84/download", host: "mpm-youtube-downloader-38.name.tldn:84"` + "\n" - - d, _ := NewNginxErrorDecoder(nil) - - root := insaneJSON.Spawn() - defer insaneJSON.Release(root) - - for b.Loop() { - _ = d.DecodeToJson(root, []byte(input)) - } -} diff --git a/decoder/postgres_test.go b/decoder/postgres_test.go index cf1f7be12..aa4661259 100644 --- a/decoder/postgres_test.go +++ b/decoder/postgres_test.go @@ -23,11 +23,8 @@ func TestPostgres(t *testing.T) { assert.Equal(t, "listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\n", root.Dig("log").AsString()) } -func BenchmarkDecodePostgresToJson(b *testing.B) { - root := insaneJSON.Spawn() - defer insaneJSON.Release(root) - +func BenchmarkDecodePostgres(b *testing.B) { for b.Loop() { - _ = DecodePostgresToJson(root, []byte("2021-06-22 16:24:27 GMT [7291] => [3-1] client=test_client,db=test_db,user=test_user LOG: listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\n")) + _, _ = DecodePostgres([]byte("2021-06-22 16:24:27 GMT [7291] => [3-1] client=test_client,db=test_db,user=test_user LOG: listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"\n")) } } diff --git a/decoder/protobuf_test.go b/decoder/protobuf_test.go index f2a1f2d33..37c9f31db 100644 --- a/decoder/protobuf_test.go +++ b/decoder/protobuf_test.go @@ -189,7 +189,7 @@ func TestProtobuf(t *testing.T) { } } -func BenchmarkProtobufDecoder_Decode(b *testing.B) { +func BenchmarkDecodeProtobuf(b *testing.B) { const protoMessage = "MyMessage" inputData := []byte{10, 13, 10, 9, 109, 121, 95, 115, 116, 114, 105, 110, 103, 16, 123, 18, 14, 10, 4, 115, 116, 114, 49, 10, 4, 115, 116, 114, 50, 16, 1, 24, 10} @@ -208,26 +208,3 @@ func BenchmarkProtobufDecoder_Decode(b *testing.B) { _, _ = dec.Decode(inputData) } } - -func BenchmarkProtobufDecoder_DecodeToJson(b *testing.B) { - const protoMessage = "MyMessage" - - inputData := []byte{10, 13, 10, 9, 109, 121, 95, 115, 116, 114, 105, 110, 103, 16, 123, 18, 14, 10, 4, 115, 116, 114, 49, 10, 4, 115, 116, 114, 50, 16, 1, 24, 10} - - p := map[string]any{ - protoFileParam: "with_imports.proto", - protoMessageParam: protoMessage, - protoImportPathsParam: []any{ - "../testdata/proto", - }, - } - - dec, _ := NewProtobufDecoder(p) - - root := insaneJSON.Spawn() - defer insaneJSON.Release(root) - - for b.Loop() { - _ = dec.DecodeToJson(root, inputData) - } -} diff --git a/decoder/syslog_rfc3164_test.go b/decoder/syslog_rfc3164_test.go index 584733ac6..b642b6ca4 100644 --- a/decoder/syslog_rfc3164_test.go +++ b/decoder/syslog_rfc3164_test.go @@ -3,7 +3,6 @@ package decoder import ( "testing" - insaneJSON "github.com/ozontech/insane-json" "github.com/stretchr/testify/assert" ) @@ -166,7 +165,7 @@ func TestSyslogRFC3164(t *testing.T) { } } -func BenchmarkSyslogRFC3164Decoder_Decode(b *testing.B) { +func BenchmarkDecodeSyslogRFC3164(b *testing.B) { const input = "<34>Oct 11 22:14:15 mymachine.example.com myproc[10]: 'myproc' failed on /dev/pts/8\n" d, _ := NewSyslogRFC3164Decoder(nil) @@ -175,16 +174,3 @@ func BenchmarkSyslogRFC3164Decoder_Decode(b *testing.B) { _, _ = d.Decode([]byte(input)) } } - -func BenchmarkSyslogRFC3164Decoder_DecodeToJson(b *testing.B) { - const input = "<34>Oct 11 22:14:15 mymachine.example.com myproc[10]: 'myproc' failed on /dev/pts/8\n" - - d, _ := NewSyslogRFC3164Decoder(nil) - - root := insaneJSON.Spawn() - defer insaneJSON.Release(root) - - for b.Loop() { - _ = d.DecodeToJson(root, []byte(input)) - } -} diff --git a/decoder/syslog_rfc5424_test.go b/decoder/syslog_rfc5424_test.go index bc4a6c38c..c7be49cd3 100644 --- a/decoder/syslog_rfc5424_test.go +++ b/decoder/syslog_rfc5424_test.go @@ -4,7 +4,6 @@ import ( "fmt" "testing" - insaneJSON "github.com/ozontech/insane-json" "github.com/stretchr/testify/assert" ) @@ -484,7 +483,7 @@ func TestSyslogRFC5424(t *testing.T) { } } -func BenchmarkSyslogRFC5424_Decode(b *testing.B) { +func BenchmarkDecodeSyslogRFC5424(b *testing.B) { const input = "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com myproc 10 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"My \\\"Application\\\"\" eventID=\"1011\"] An application event log\n" d, _ := NewSyslogRFC5424Decoder(nil) @@ -493,16 +492,3 @@ func BenchmarkSyslogRFC5424_Decode(b *testing.B) { _, _ = d.Decode([]byte(input)) } } - -func BenchmarkSyslogRFC5424_DecodeToJson(b *testing.B) { - const input = "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com myproc 10 ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"My \\\"Application\\\"\" eventID=\"1011\"] An application event log\n" - - d, _ := NewSyslogRFC5424Decoder(nil) - - root := insaneJSON.Spawn() - defer insaneJSON.Release(root) - - for b.Loop() { - _ = d.DecodeToJson(root, []byte(input)) - } -}