(b *testing.B)
| 556 | } |
| 557 | |
| 558 | func BenchmarkCompress1XReuseNone(b *testing.B) { |
| 559 | for _, tt := range testfiles { |
| 560 | test := tt |
| 561 | if test.err1X != nil { |
| 562 | continue |
| 563 | } |
| 564 | b.Run(test.name, func(b *testing.B) { |
| 565 | var s Scratch |
| 566 | s.Reuse = ReusePolicyNone |
| 567 | buf0, err := test.fn() |
| 568 | if err != nil { |
| 569 | b.Fatal(err) |
| 570 | } |
| 571 | if len(buf0) > BlockSizeMax { |
| 572 | buf0 = buf0[:BlockSizeMax] |
| 573 | } |
| 574 | _, _, err = Compress1X(buf0, &s) |
| 575 | if err != test.err1X { |
| 576 | b.Fatal("unexpected error:", err) |
| 577 | } |
| 578 | b.ResetTimer() |
| 579 | b.ReportAllocs() |
| 580 | b.SetBytes(int64(len(buf0))) |
| 581 | for i := 0; i < b.N; i++ { |
| 582 | _, re, _ := Compress1X(buf0, &s) |
| 583 | if re { |
| 584 | b.Fatal("reused") |
| 585 | } |
| 586 | } |
| 587 | }) |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | func BenchmarkCompress1XReuseAllow(b *testing.B) { |
| 592 | for _, tt := range testfiles { |
nothing calls this directly
no test coverage detected
searching dependent graphs…