MCPcopy Create free account
hub / github.com/google/uuid / BenchmarkUUID_MarshalJSON

Function BenchmarkUUID_MarshalJSON

json_test.go:85–100  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

83}
84
85func BenchmarkUUID_MarshalJSON(b *testing.B) {
86 x := &struct {
87 UUID UUID `json:"uuid"`
88 }{}
89 var err error
90 x.UUID, err = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
91 if err != nil {
92 b.Fatal(err)
93 }
94 for i := 0; i < b.N; i++ {
95 js, err := json.Marshal(x)
96 if err != nil {
97 b.Fatalf("marshal json: %#v (%v)", js, err)
98 }
99 }
100}
101
102func BenchmarkUUID_UnmarshalJSON(b *testing.B) {
103 js := []byte(`{"uuid":"f47ac10b-58cc-0372-8567-0e02b2c3d479"}`)

Callers

nothing calls this directly

Calls 1

ParseFunction · 0.85

Tested by

no test coverage detected