MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / BenchmarkInjectJSONPropertiesFromBytes

Function BenchmarkInjectJSONPropertiesFromBytes

base/util_test.go:1209–1246  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1207}
1208
1209func BenchmarkInjectJSONPropertiesFromBytes(b *testing.B) {
1210 newKVBytes := []KVPairBytes{
1211 {
1212 Key: "newval",
1213 Val: []byte(`{"abc":123,"nums":["one","two","three"],"test":true}`),
1214 },
1215 {
1216 Key: "test",
1217 Val: []byte(`true`),
1218 },
1219 {
1220 Key: "asdf",
1221 Val: []byte(`"qwerty"`),
1222 },
1223 }
1224
1225 tests := []struct {
1226 input string
1227 }{
1228 {
1229 input: `null`,
1230 },
1231 {
1232 input: "{}",
1233 },
1234 {
1235 input: `{"key":"val"}`,
1236 },
1237 }
1238
1239 for _, test := range tests {
1240 b.Run(test.input, func(bb *testing.B) {
1241 for i := 0; i < bb.N; i++ {
1242 _, _ = InjectJSONPropertiesFromBytes([]byte(test.input), newKVBytes...)
1243 }
1244 })
1245 }
1246}
1247
1248func BenchmarkInjectJSONPropertiesFromBytes_Multiple(b *testing.B) {
1249 newKVBytes := KVPairBytes{

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65

Tested by

no test coverage detected