julia> using BenchmarkTools, WAV
julia> y = sin.((0:9999999)/48000*2pi*440);
julia> wavwrite(y, "test.wav", Fs=48000)
julia> @btime wavread("test.wav")
4.597 s (29999537 allocations: 572.20 MiB)
after:
julia> @btime wavread("test.wav")
321.458 ms (10000049 allocations: 305.18 MiB)
Completely fixing #52 is almost certainly possible, but would probably require something like https://github.com/tkoolen/FastIOBuffers.jl to speed up reading Float32s from IO streams.
Coverage remained the same at 72.535% when pulling 952862f1ff99240240787c9c8831d891c921c040 on rdeits:rd/performance into 0869a0cd407f6724a95255ccdb61b0c8c38f17cd on dancasimiro:master.
I found a couple of low-hanging fruit for improving the performance of reading WAV files:
::Type{T} where T
instead of justT
as an argument to ensure Julia specializes on that typeMore improvements should be possible, but this already gave a better than 10x speedup, so I figured I'd open a PR.
Before (on Julia 0.7), using the test file from https://github.com/dancasimiro/WAV.jl/issues/52 :
after:
Completely fixing #52 is almost certainly possible, but would probably require something like https://github.com/tkoolen/FastIOBuffers.jl to speed up reading Float32s from IO streams.