[Rd] Resolving functions using R's namespace mechanism can double runtime
Romain Francois
romain at r-enthusiasts.com
Tue Apr 27 22:38:45 CEST 2010
Le 27/04/10 22:16, Dominick Samperi a écrit :
> It appears that the runtime for an R script can more than double if a few
> references to a function foo() are replaced by more explict references
> of the form pkgname::foo().
It would probably help your question if you provide some benchmarks.
a::b is just a shortcut for `::`( a, b ).
> The more explicit references are of course required when two
> loaded packages define the same function.
Not really. You can :
- resolve once: my_foo <- pkgname::foo
- import the variable into your namespace using the importFrom namespace
directive.
> I can understand why use of this mechanism is not free in an
> interpreted environment like R, but the cost seems rather high.
>
> Dominick
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/9aKDM9 : embed images in Rd documents
|- http://tr.im/OIXN : raster images and RImageJ
|- http://tr.im/OcQe : Rcpp 0.7.7
More information about the R-devel
mailing list