MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / BenchmarkPopulateQueryParameters

Function BenchmarkPopulateQueryParameters

runtime/query_test.go:23–86  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

21)
22
23func BenchmarkPopulateQueryParameters(b *testing.B) {
24 timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC)
25 timeStr := timeT.Format(time.RFC3339Nano)
26
27 durationT := 13 * time.Hour
28 durationStr := durationT.String()
29
30 fieldmaskStr := "float_value,double_value"
31
32 msg := &examplepb.Proto3Message{}
33 values := url.Values{
34 "float_value": {"1.5"},
35 "double_value": {"2.5"},
36 "int64_value": {"-1"},
37 "int32_value": {"-2"},
38 "uint64_value": {"3"},
39 "uint32_value": {"4"},
40 "bool_value": {"true"},
41 "string_value": {"str"},
42 "bytes_value": {"Ynl0ZXM="},
43 "repeated_value": {"a", "b", "c"},
44 "enum_value": {"1"},
45 "repeated_enum": {"1", "2", "0"},
46 "timestamp_value": {timeStr},
47 "duration_value": {durationStr},
48 "fieldmask_value": {fieldmaskStr},
49 "optional_string_value": {"optional-str"},
50 "wrapper_float_value": {"1.5"},
51 "wrapper_double_value": {"2.5"},
52 "wrapper_int64_value": {"-1"},
53 "wrapper_int32_value": {"-2"},
54 "wrapper_u_int64_value": {"3"},
55 "wrapper_u_int32_value": {"4"},
56 "wrapper_bool_value": {"true"},
57 "wrapper_string_value": {"str"},
58 "wrapper_bytes_value": {"Ynl0ZXM="},
59 "map_value[key]": {"value"},
60 "map_value[second]": {"bar"},
61 "map_value[third]": {"zzz"},
62 "map_value[fourth]": {""},
63 `map_value[~!@#$%^&*()]`: {"value"},
64 "map_value2[key]": {"-2"},
65 "map_value3[-2]": {"value"},
66 "map_value4[key]": {"-1"},
67 "map_value5[-1]": {"value"},
68 "map_value6[key]": {"3"},
69 "map_value7[3]": {"value"},
70 "map_value8[key]": {"4"},
71 "map_value9[4]": {"value"},
72 "map_value10[key]": {"1.5"},
73 "map_value11[1.5]": {"value"},
74 "map_value12[key]": {"2.5"},
75 "map_value13[2.5]": {"value"},
76 "map_value14[key]": {"true"},
77 "map_value15[true]": {"value"},
78 }
79 filter := utilities.NewDoubleArray([][]string{
80 {"bool_value"}, {"repeated_value"},

Callers

nothing calls this directly

Calls 3

NewDoubleArrayFunction · 0.92
PopulateQueryParametersFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected