MCPcopy
hub / github.com/golang-jwt/jwt / benchmarkParsing

Function benchmarkParsing

parser_test.go:864–876  ·  view source on GitHub ↗

Helper method for benchmarking various parsing methods

(b *testing.B, parser *jwt.Parser, tokenString string, claims jwt.Claims)

Source from the content-addressed store, hash-verified

862
863// Helper method for benchmarking various parsing methods
864func benchmarkParsing(b *testing.B, parser *jwt.Parser, tokenString string, claims jwt.Claims) {
865 b.Helper()
866 b.ReportAllocs()
867 b.ResetTimer()
868 b.RunParallel(func(pb *testing.PB) {
869 for pb.Next() {
870 _, _, err := parser.ParseUnverified(tokenString, jwt.MapClaims{})
871 if err != nil {
872 b.Fatal(err)
873 }
874 }
875 })
876}
877
878// Helper method for benchmarking various signing methods
879func benchmarkSigning(b *testing.B, method jwt.SigningMethod, key any) {

Callers 1

BenchmarkParseUnverifiedFunction · 0.85

Calls 1

ParseUnverifiedMethod · 0.80

Tested by

no test coverage detected