MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / BenchmarkTypes

Function BenchmarkTypes

types/types_test.go:522–563  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

520}
521
522func BenchmarkTypes(b *testing.B) {
523 var (
524 // Build a approximate 1KB request
525 req = buildRequest(WriteQuery, []Query{
526 buildQuery(
527 `INSERT INTO "t1" VALUES (?, ?, ?, ?)`,
528 rand.Int(),
529 randBytes(333),
530 randBytes(333),
531 randBytes(333),
532 ),
533 })
534 // Build a approximate 1KB response with the previous request header
535 resp = buildResponse(
536 &req.Header,
537 []string{"k", "v1", "v2", "v3"},
538 []string{"INT", "TEXT", "TEXT", "TEXT"},
539 []ResponseRow{
540 {
541 Values: []interface{}{
542 rand.Int(),
543 randBytes(333),
544 randBytes(333),
545 randBytes(333),
546 },
547 },
548 },
549 )
550 )
551 var subjects = [...]interface{}{req, resp}
552 for _, v := range subjects {
553 var name = reflect.ValueOf(v).Elem().Type().Name()
554 b.Run(fmt.Sprint(name, "Enc"), func(b *testing.B) { benchmarkEnc(b, v) })
555 b.Run(fmt.Sprint(name, "Dec"), func(b *testing.B) { benchmarkDec(b, v) })
556 if x, ok := v.(ver); ok {
557 b.Run(fmt.Sprint(name, "Verify"), func(b *testing.B) { benchmarkVerify(b, x) })
558 }
559 if x, ok := v.(ser); ok {
560 b.Run(fmt.Sprint(name, "Sign"), func(b *testing.B) { benchmarkSign(b, x) })
561 }
562 }
563}

Callers

nothing calls this directly

Calls 9

randBytesFunction · 0.85
buildResponseFunction · 0.85
benchmarkEncFunction · 0.85
benchmarkDecFunction · 0.85
benchmarkVerifyFunction · 0.85
benchmarkSignFunction · 0.85
NameMethod · 0.80
buildRequestFunction · 0.70
buildQueryFunction · 0.70

Tested by

no test coverage detected