azul3d-legacy / audio-wav

audio/wav package
http://azul3d.org/audio/wav.v1
Other
14 stars 3 forks source link

More performance enhancements #8

Open slimsag opened 10 years ago

slimsag commented 10 years ago

Moving the previous discussion from azul3d/audio#5 to here.

slimsag commented 10 years ago

By removing binary.Read calls in tight loops (mostly due to it's small buffer allocation internally) we have gained roughly a 60% performance improvement with Int24 decoding now on-par with the other decoders (finally).

benchmark                  old ns/op     new ns/op     delta       
BenchmarkDecodeFloat32     14861757      5489679       -63.06%     
BenchmarkDecodeFloat64     16008682      7067748       -55.85%     
BenchmarkDecodeUint8       13951858      4908209       -64.82%     
BenchmarkDecodeInt16       14685837      5394720       -63.27%     
BenchmarkDecodeInt24       50474652      5591962       -88.92%     
BenchmarkDecodeInt32       15584887      5472800       -64.88%     
BenchmarkDecodeALaw        14637388      4956828       -66.14%     
BenchmarkDecodeMuLaw       14626045      4966246       -66.05%