github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/audio/benchmark/mix_test.go (about) 1 package benchmark_audio 2 3 import ( 4 "testing" 5 ) 6 7 var ( 8 tmp_dst = make([]float32, TestFrameCount) 9 tmp_a = make([]float32, TestFrameCount) 10 tmp_b = make([]float32, TestFrameCount) 11 ) 12 13 func BenchmarkMix_Dynamic(b *testing.B) { 14 b.SetBytes(TestBytes) 15 for i := 0; i < b.N; i++ { 16 Mix_Dynamic(tmp_dst, tmp_a, tmp_b) 17 } 18 } 19 20 func BenchmarkMix_Baseline(b *testing.B) { 21 b.SetBytes(TestBytes) 22 for i := 0; i < b.N; i++ { 23 Mix_Baseline(tmp_dst, tmp_a, tmp_b) 24 } 25 } 26 27 func BenchmarkMixInto_Dynamic(b *testing.B) { 28 b.SetBytes(TestBytes) 29 for i := 0; i < b.N; i++ { 30 MixInto_Dynamic(tmp_a, tmp_b) 31 } 32 } 33 34 func BenchmarkMixInto_Baseline(b *testing.B) { 35 b.SetBytes(TestBytes) 36 for i := 0; i < b.N; i++ { 37 MixInto_Baseline(tmp_a, tmp_b) 38 } 39 }