Bench result: BenchmarkEncodeValue 5000000 368 ns/op
(b *testing.B)
| 555 | // Bench result: |
| 556 | // BenchmarkEncodeValue 5000000 368 ns/op |
| 557 | func BenchmarkEncodeValue(b *testing.B) { |
| 558 | sc := stmtctx.NewStmtCtx() |
| 559 | |
| 560 | row := make([]types.Datum, 7) |
| 561 | row[0] = types.NewIntDatum(100) |
| 562 | row[1] = types.NewBytesDatum([]byte("abc")) |
| 563 | row[2] = types.NewDecimalDatum(types.NewDecFromInt(1)) |
| 564 | row[3] = types.NewMysqlEnumDatum(types.Enum{Name: "a", Value: 0}) |
| 565 | row[4] = types.NewDatum(types.Set{Name: "a", Value: 0}) |
| 566 | row[5] = types.NewDatum(types.BinaryLiteral{100}) |
| 567 | row[6] = types.NewFloat32Datum(1.5) |
| 568 | b.ResetTimer() |
| 569 | encodedCol := make([]byte, 0, 16) |
| 570 | for i := 0; i < b.N; i++ { |
| 571 | for _, d := range row { |
| 572 | encodedCol = encodedCol[:0] |
| 573 | _, err := EncodeValue(sc.TimeZone(), encodedCol, d) |
| 574 | if err != nil { |
| 575 | b.Fatal(err) |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | func TestError(t *testing.T) { |
| 582 | kvErrs := []*terror.Error{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…