From help-request at octave dot org Sat Jan 15 17:01:25 2005 Subject: Re: Very slow filter.cc From: David Bateman To: akira at rsch dot tuis dot ac dot jp, help@octave.org Date: Sun, 16 Jan 2005 00:03:27 +0100 Hi Akira, akira at rsch dot tuis dot ac dot jp wrote: >I recently begin to use the development version of octave (2.1.64) and >found that filter function is very slow compared with that of >octave-2.0.17. > >The test code I attached the last part of this mail showed that the >new filter function (2.1.64) is 9 times slower than the old filter >function (2.0.17). I converted codes executing actual filtering from >the old filter.cc to the new filter.cc, it made five times faster than >the new filter.cc of 2.1.64. It still twice slower than the old filter >function. The rest of the new filter.cc may be codes for input, output >and error handling and I was not able to figure out the problem. > >I suspect that the reason of slow filter function is NDArray support >for >the third and fourth arguments of the filter function. The speed of >filter function should be very critical for users of digital signal >processing and I want to say goodby to the slow filter function. > >I compiled octave-2.1.64 with ATLAS-3.6 and FFTW-3.0.1. Please tell me >the way to speed up filter function. > > I'd taken note of this an had hoped to investigate the problem a little, as if as you suspect the problem is due to the conversion to NDArray's then its my fault as I wrote that code. However, it seems unlikely I'll have any time to look at this soon, and hope you might be able to investigate further... What was going to be my first step was to compile three different versions of octave. These being 2.1.50, 2.1.57 and 2.1.64, which correspond to the last three testing releases. The first before NDArray's were integrated, the second when NDArray's were integrated, but the filter function wasn't changed to use them and the last with the filter function converted to NDArray's. Getting the times of the test case you propose for these three build, would really confirm your problem. I can't promise to do anything with this information rapidly, so feel free to search for a better implementation of an NDArray filter function if you do indeed confirm that this is the base problem. However, if you don't do it, I'll eventually get araound to it, at least before the magical version 3.0 release :-) Regards David >==== test code 1 ==== > >x = randn(1e6,1); b = randn(500,1); >tic, y = filter(b, 1, x); toc > ># AthlonXP 2200+ octave-2.1.64 Linux-2.4.27 >ans = 14.712 > ># AthlonXP 2200+ octave-2.0.17 Linux-2.4.27 >ans = 1.6280 > >==== test code 2 ==== > >x = randn(1e5,10); b = randn(500,1); >tic, y = filter(b, 1, x); toc > ># AthlonXP 2200+ octave-2.1.64 Linux-2.4.27 >ans = 14.430 > ># Multi-dimensional array does not contribute its speed!! > >==== test code 3 ==== > >x = randn(1e5,10); b = randn(500,1); >tic, for k=1:10 >y(:,k) = filter(b, 1, x(:,k)); >end; toc > ># AthlonXP 2200+ octave-2.0.17 Linux-2.4.27 >ans = 1.7135 > >_/_/_/ _/ _/ _/ _/_/ Akira NISHIMURA > _/ _/ _/ _/ | Dept. of Media and Cultural Studies >_/okyo _/_/niversity of _/nformation _/_/ciences akira at rsch dot tuis dot ac dot jp > http://www.rsch.tuis.ac.jp/~akira > > > > > > > > >------------------------------------------------------------- >Octave is freely available under the terms of the GNU GPL. > >Octave's home on the web: http://www.octave.org >How to fund new projects: http://www.octave.org/funding.html >Subscription information: http://www.octave.org/archive.html >------------------------------------------------------------- > > > -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------