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

Function BenchmarkCompress1XReuseNone

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

Source from the content-addressed store, hash-verified

556}
557
558func 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
591func BenchmarkCompress1XReuseAllow(b *testing.B) {
592 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…