MCPcopy
hub / github.com/klauspost/compress / BenchmarkCompress1XReuseAllow

Function BenchmarkCompress1XReuseAllow

huff0/compress_test.go:591–622  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

589}
590
591func 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
624func BenchmarkCompress1XReusePrefer(b *testing.B) {
625 for _, tt := range testfiles {

Callers

nothing calls this directly

Calls 2

Compress1XFunction · 0.85
FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…