github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/kit/httptransport/transformer/z_tsfm_super_test.go (about) 1 package transformer_test 2 3 import ( 4 "testing" 5 6 . "github.com/machinefi/w3bstream/pkg/depends/kit/httptransport/transformer" 7 ) 8 9 func BenchmarkTransformerSuper(b *testing.B) { 10 ts := NewSuper(&PlainText{}, &CommonOption{Omitempty: true}) 11 12 b.Run("DecodeFromBySuper", func(b *testing.B) { 13 ret := "" 14 for i := 0; i < b.N; i++ { 15 _ = ts.DecodeFrom(bgctx, NewStringReader("111"), &ret) 16 } 17 // b.Log(ret) 18 }) 19 20 b.Run("DecodeFromDirect", func(b *testing.B) { 21 pt := PlainText{} 22 ret := "" 23 for i := 0; i < b.N; i++ { 24 _ = pt.DecodeFrom(bgctx, NewStringReader("111"), &ret) 25 } 26 // b.Log(ret) 27 }) 28 }