From 774a9875db005716e0130fae489a30d090b510d8 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sat, 2 Apr 2022 11:52:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/http_access_log_dao_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/db/models/http_access_log_dao_test.go b/internal/db/models/http_access_log_dao_test.go index 30fa7191..34729917 100644 --- a/internal/db/models/http_access_log_dao_test.go +++ b/internal/db/models/http_access_log_dao_test.go @@ -1,6 +1,7 @@ package models import ( + "encoding/json" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" _ "github.com/go-sql-driver/mysql" _ "github.com/iwind/TeaGo/bootstrap" @@ -157,3 +158,13 @@ func TestHTTPAccessLogDAO_ListAccessLogs_Page_NotExists(t *testing.T) { } } } + +func BenchmarkHTTPAccessLogDAO_JSONEncode(b *testing.B) { + var accessLog = &pb.HTTPAccessLog{ + RequestPath: "/hello/world", + } + + for i := 0; i < b.N; i++ { + _, _ = json.Marshal(accessLog) + } +}