(b *testing.B)
| 589 | } |
| 590 | |
| 591 | func BenchmarkCompress1XReuseAllow(b *testing.B) { |
| 592 | for _, tt := range testfiles { |
| 593 | test := tt |
| 594 | if test.err1X != nil { |
| 595 | continue |
| 596 | } |
| 597 | b.Run(test.name, func(b *testing.B) { |
| 598 | var s Scratch |
| 599 | s.Reuse = ReusePolicyAllow |
| 600 | buf0, err := test.fn() |
| 601 | if err != nil { |
| 602 | b.Fatal(err) |
| 603 | } |
| 604 | if len(buf0) > BlockSizeMax { |
| 605 | buf0 = buf0[:BlockSizeMax] |
| 606 | } |
| 607 | _, _, err = Compress1X(buf0, &s) |
| 608 | if err != test.err1X { |
| 609 | b.Fatal("unexpected error:", err) |
| 610 | } |
| 611 | b.ResetTimer() |
| 612 | b.ReportAllocs() |
| 613 | b.SetBytes(int64(len(buf0))) |
| 614 | for i := 0; i < b.N; i++ { |
| 615 | _, re, _ := Compress1X(buf0, &s) |
| 616 | if !re { |
| 617 | b.Fatal("not reused") |
| 618 | } |
| 619 | } |
| 620 | }) |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | func BenchmarkCompress1XReusePrefer(b *testing.B) { |
| 625 | for _, tt := range testfiles { |
nothing calls this directly
no test coverage detected
searching dependent graphs…