[Rcpp-devel] Optimising 2d convolution

Hadley Wickham hadley at rice.edu
Tue Jan 10 16:22:28 CET 2012


> I get quite a speed up on hadley's example:
>
> utilisateur     système      écoulé
>      1.555       0.003       1.558
> utilisateur     système      écoulé
>      0.547       0.004       0.550
> [1] TRUE

Thanks Romain! I get a similar improvement:

system.time(convolve_2d(x, k))
#  user  system elapsed
# 2.295   0.014   2.410

system.time(convolve_2d_tricks(x, k))
#  user  system elapsed
# 0.807   0.001   0.821

> The idea is that we compute pointers and constants just once, asap, so that
> we don't have to do it again in inner loops.

Makes sense.  Thanks!

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/


More information about the Rcpp-devel mailing list