(b *testing.B)
| 452 | } |
| 453 | |
| 454 | func BenchmarkEncode(b *testing.B) { |
| 455 | b.Run("int64", func(b *testing.B) { |
| 456 | for i := 0; i < b.N; i++ { |
| 457 | encode(int64(1234), oid.T_int8) |
| 458 | } |
| 459 | }) |
| 460 | b.Run("float64", func(b *testing.B) { |
| 461 | for i := 0; i < b.N; i++ { |
| 462 | encode(3.14159, oid.T_float8) |
| 463 | } |
| 464 | }) |
| 465 | b.Run("bool", func(b *testing.B) { |
| 466 | for i := 0; i < b.N; i++ { |
| 467 | encode(true, oid.T_bool) |
| 468 | } |
| 469 | }) |
| 470 | b.Run("timestamptz", func(b *testing.B) { |
| 471 | x := time.Date(2001, time.January, 1, 0, 0, 0, 0, time.Local) |
| 472 | for i := 0; i < b.N; i++ { |
| 473 | encode(x, oid.T_timestamptz) |
| 474 | } |
| 475 | }) |
| 476 | b.Run("bytea_hex", func(b *testing.B) { |
| 477 | x := []byte("abcdefghijklmnopqrstuvwxyz") |
| 478 | for i := 0; i < b.N; i++ { |
| 479 | encode(x, oid.T_bytea) |
| 480 | } |
| 481 | }) |
| 482 | b.Run("bytea_escape", func(b *testing.B) { |
| 483 | x := []byte("abcdefghijklmnopqrstuvwxyz") |
| 484 | for i := 0; i < b.N; i++ { |
| 485 | encode(x, oid.T_bytea) |
| 486 | } |
| 487 | }) |
| 488 | } |
| 489 | |
| 490 | func BenchmarkAppendEscapedText(b *testing.B) { |
| 491 | b.Run("100 lines", func(b *testing.B) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…