Codebase list golang-github-vbauerster-mpb / cf6bc3e barbench_test.go
cf6bc3e

Tree @cf6bc3e (Download .tar.gz)

barbench_test.go @cf6bc3eraw · history · blame

package mpb

import (
	"io/ioutil"
	"testing"
)

func BenchmarkIncrSingleBar(b *testing.B) {
	p := New(WithOutput(ioutil.Discard))
	bar := p.AddBar(int64(b.N))
	for i := 0; i < b.N; i++ {
		bar.Increment()
	}
}

func BenchmarkIncrSingleBarWhileIsNotCompleted(b *testing.B) {
	p := New(WithOutput(ioutil.Discard))
	bar := p.AddBar(int64(b.N))
	for !bar.Completed() {
		bar.Increment()
	}
}