filterfir vs convolve speed
fabrizio
According to the 'filterfir' documentation,
FilterFIR filters data faster than Convolve when there are many fewer filter coefficient values than data points in waveName.
However, when I execute the following code:
filterfir/lo={0.3,0.31,201}/coef coefs
make/o/d/n=1e7 data
variable tim
tim = ticks; filterfir/coef=coefs data; tim = ticks-tim; print tim
tim = ticks; convolve coefs, data; tim = ticks-tim; print tim
make/o/d/n=1e7 data
variable tim
tim = ticks; filterfir/coef=coefs data; tim = ticks-tim; print tim
tim = ticks; convolve coefs, data; tim = ticks-tim; print tim
the convolve operation is ~4x faster (~190 ticks for filterfir vs ~44 ticks for convolve on a intel core i7 870). Based on the filterfir documentation, I expected the opposite behaviour. Am I missing or misunderstanding something?
Igor pro 64 bit 6.34A, windows 7
Thanks,
Fabrizio
May 21, 2014 at 01:38 am - Permalink
filterfir/lo={0.3,0.31,201}/coef coefs
make/o/d/n=1e7 data
variable tim
tim = ticks; filterfir/coef=coefs data; tim = ticks-tim; print tim
tim = ticks; convolve coefs, data; tim = ticks-tim; print tim
- Fabrizio
May 21, 2014 at 07:54 am - Permalink
The promise of faster speed is vague on purpose; many factors come into play.
FilterFIR uses only time-domain convolution, which is a straightforward sum of products.
Convolve conditionally uses segmented overlapped FFTs when it thinks it will be faster (and often is).
FilterFIR is faster only when the number of coefficients is quite small, around 23 points in your example.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
May 21, 2014 at 11:17 am - Permalink
May 21, 2014 at 12:14 pm - Permalink