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)}
|
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true)}
|
||||||
err := cfg.Validate()
|
err := cfg.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Config struct is bad: %v#", err)
|
b.Fatalf("config struct is bad: %v#", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer := &dumbWriteCloser{}
|
f := NewBasic(&dumbWriteCloser{}, cfg)
|
||||||
f := NewBasic(buffer, cfg)
|
|
||||||
b.Log("Frames: ", len(testPackets))
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
_, err := f.Write(x)
|
_, err := f.Write(x)
|
||||||
|
@ -57,18 +55,18 @@ func BenchmarkBasic(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.Log("Frames: ", len(testPackets))
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkDifference(b *testing.B) {
|
func BenchmarkDifference(b *testing.B) {
|
||||||
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true)}
|
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true)}
|
||||||
err := cfg.Validate()
|
err := cfg.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Config struct is bad: %v#", err)
|
b.Fatalf("config struct is bad: %v#", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer := &dumbWriteCloser{}
|
f := NewDiff(&dumbWriteCloser{}, cfg)
|
||||||
f := NewDiff(buffer, cfg)
|
|
||||||
b.Log("Frames: ", len(testPackets))
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
_, err := f.Write(x)
|
_, err := f.Write(x)
|
||||||
|
@ -77,18 +75,18 @@ func BenchmarkDifference(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.Log("Frames: ", len(testPackets))
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkKNN(b *testing.B) {
|
func BenchmarkKNN(b *testing.B) {
|
||||||
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true), MotionDownscaling: downscale}
|
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true), MotionDownscaling: downscale}
|
||||||
err := cfg.Validate()
|
err := cfg.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Config struct is bad: %v#", err)
|
b.Fatalf("config struct is bad: %v#", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer := &dumbWriteCloser{}
|
f := NewKNN(&dumbWriteCloser{}, cfg)
|
||||||
f := NewKNN(buffer, cfg)
|
|
||||||
b.Log("Frames: ", len(testPackets))
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
_, err := f.Write(x)
|
_, err := f.Write(x)
|
||||||
|
@ -97,18 +95,18 @@ func BenchmarkKNN(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.Log("Frames: ", len(testPackets))
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkMOG(b *testing.B) {
|
func BenchmarkMOG(b *testing.B) {
|
||||||
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true), MotionDownscaling: downscale}
|
cfg := config.Config{Logger: logger.New(logger.Debug, &bytes.Buffer{}, true), MotionDownscaling: downscale}
|
||||||
err := cfg.Validate()
|
err := cfg.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Config struct is bad: %v#", err)
|
b.Fatalf("config struct is bad: %v#", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer := &dumbWriteCloser{}
|
f := NewMOG(&dumbWriteCloser{}, cfg)
|
||||||
f := NewMOG(buffer, cfg)
|
|
||||||
b.Log("Frames: ", len(testPackets))
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
for _, x := range testPackets {
|
for _, x := range testPackets {
|
||||||
_, err := f.Write(x)
|
_, err := f.Write(x)
|
||||||
|
@ -117,4 +115,6 @@ func BenchmarkMOG(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.Log("Frames: ", len(testPackets))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue