From romain at r-enthusiasts.com  Tue Apr 27 22:38:45 2010
From: romain at r-enthusiasts.com (Romain Francois)
Date: Tue, 27 Apr 2010 22:38:45 +0200
Subject: [Rd] Resolving functions using R's namespace mechanism can
 double runtime
In-Reply-To: <g2gd4cf43b61004271316p316d0d64ya9e53412b8a8df73@mail.gmail.com>
References: <g2gd4cf43b61004271316p316d0d64ya9e53412b8a8df73@mail.gmail.com>
Message-ID: <4BD74B55.7070004@r-enthusiasts.com>


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



[Rd] Resolving functions using R's namespace mechanism can double runtime
Romain Francois