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) + } +}