Add bench with name decorator
Vladimir Bauer
8 years ago
| 2 | 2 | import ( |
| 3 | 3 | "io/ioutil" |
| 4 | 4 | "testing" |
| 5 | ||
| 6 | "github.com/vbauerster/mpb/decor" | |
| 5 | 7 | ) |
| 6 | 8 | |
| 7 | 9 | func BenchmarkIncrSingleBar(b *testing.B) { |
| 19 | 21 | bar.Increment() |
| 20 | 22 | } |
| 21 | 23 | } |
| 24 | ||
| 25 | func BenchmarkIncrSingleBarWithNameDecorator(b *testing.B) { | |
| 26 | p := New(WithOutput(ioutil.Discard)) | |
| 27 | bar := p.AddBar(int64(b.N), PrependDecorators(decor.Name("test"))) | |
| 28 | for i := 0; i < b.N; i++ { | |
| 29 | bar.Increment() | |
| 30 | } | |
| 31 | } | |