JuliaLang/julia — pull request #7698 by simonster (2014-07-23 01:10:58+00:00)
Title: Faster filt/filt!

I started benchmarking our DSP functions, and noticed that, while our `filt` was often faster than MATLAB's, it was usually slower than Octave's. `code_llvm` showed that there were a lot of loads marked `%jtbaa_arrayptr` in the inner loop that were not being hoisted out, even though there is no way the array pointer could change. Moving the hot loops to a separate function gives a 1.2-1.5x perf gain and also mitigates effects of type instability of `b` and `a` due to coefficient normalization if `b` or `a` are Ints. This makes our `filt` faster than MATLAB and competitive with Octave (sometimes a bit slower, probably due to GC) for every set of parameters I tested.