Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 702 Bytes

benchmark.md

File metadata and controls

28 lines (19 loc) · 702 Bytes

Go Benchmark

benchmark executed by the "go test" command when its -bench flag is provided. Benchmarks are run sequentially.

func BenchmarkRandInt(b *testing.B) {
    for i := 0; i < b.N; i++ {
        rand.Int()
    }
}

go test -run=TestFib -v

go test -run=xxx -v -bench=.

go test -run=xxx -v -bench=. -benchtime=3s

Testing With Memory Allocation

go test -benchmem -run=^$ -bench ^BenchmarkSs* graphmysql/utility

go test -benchmem -bench ^BenchmarkSs* graphmysql/utility

No testing only Benchmark with memory allocation

go test -run=^$ -benchmem -bench ^BenchmarkGetpass* graphmysql/utility

Withour memory

go test -bench ^BenchmarkSs* graphmysql/utility