mirror of https://bitbucket.org/ausocean/av.git
filter: benchmark: tidy
This commit is contained in:
parent
8dfddfbc1e
commit
d24a0e688e
|
@ -43,12 +43,10 @@ func BenchmarkBasic(b *testing.B) {
|
|||
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true)}
|
||||
err := cfg.Validate()
|
||||
if err != nil {
|
||||
b.Fatalf("Config struct is bad: %v#", err)
|
||||
b.Fatalf("config struct is bad: %v#", err)
|
||||
}
|
||||
|
||||
buffer := &dumbWriteCloser{}
|
||||
f := NewBasic(buffer, cfg)
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
f := NewBasic(&dumbWriteCloser{}, cfg)
|
||||
for n := 0; n < b.N; n++ {
|
||||
for _, x := range testPackets {
|
||||
_, err := f.Write(x)
|
||||
|
@ -57,18 +55,18 @@ func BenchmarkBasic(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
}
|
||||
|
||||
func BenchmarkDifference(b *testing.B) {
|
||||
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true)}
|
||||
err := cfg.Validate()
|
||||
if err != nil {
|
||||
b.Fatalf("Config struct is bad: %v#", err)
|
||||
b.Fatalf("config struct is bad: %v#", err)
|
||||
}
|
||||
|
||||
buffer := &dumbWriteCloser{}
|
||||
f := NewDiff(buffer, cfg)
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
f := NewDiff(&dumbWriteCloser{}, cfg)
|
||||
for n := 0; n < b.N; n++ {
|
||||
for _, x := range testPackets {
|
||||
_, err := f.Write(x)
|
||||
|
@ -77,18 +75,18 @@ func BenchmarkDifference(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
}
|
||||
|
||||
func BenchmarkKNN(b *testing.B) {
|
||||
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true), MotionDownscaling: downscale}
|
||||
err := cfg.Validate()
|
||||
if err != nil {
|
||||
b.Fatalf("Config struct is bad: %v#", err)
|
||||
b.Fatalf("config struct is bad: %v#", err)
|
||||
}
|
||||
|
||||
buffer := &dumbWriteCloser{}
|
||||
f := NewKNN(buffer, cfg)
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
f := NewKNN(&dumbWriteCloser{}, cfg)
|
||||
for n := 0; n < b.N; n++ {
|
||||
for _, x := range testPackets {
|
||||
_, err := f.Write(x)
|
||||
|
@ -97,18 +95,18 @@ func BenchmarkKNN(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
}
|
||||
|
||||
func BenchmarkMOG(b *testing.B) {
|
||||
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true), MotionDownscaling: downscale}
|
||||
err := cfg.Validate()
|
||||
if err != nil {
|
||||
b.Fatalf("Config struct is bad: %v#", err)
|
||||
b.Fatalf("config struct is bad: %v#", err)
|
||||
}
|
||||
|
||||
buffer := &dumbWriteCloser{}
|
||||
f := NewMOG(buffer, cfg)
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
f := NewMOG(&dumbWriteCloser{}, cfg)
|
||||
for n := 0; n < b.N; n++ {
|
||||
for _, x := range testPackets {
|
||||
_, err := f.Write(x)
|
||||
|
@ -117,4 +115,6 @@ func BenchmarkMOG(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Log("Frames: ", len(testPackets))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue