From phgrosjean at sciviews.org  Sun Oct 17 18:33:48 2004
From: phgrosjean at sciviews.org (Philippe Grosjean)
Date: Sun Oct 17 18:34:15 2004
Subject: [Rd] Lazy loading - importance of NAMESPACE
Message-ID: <200410171633.i9HGXnaF003532@outmx015.isp.belgacom.be>

Hello all,

Following a question in r-help, where I was wondering why my large package
with lots of "Depends:" did load so slowly (almost 30 sec in lazy loading in
R 2.0.0 under Win XP, for 3.4 sec in R 1.9.1 on the same machine), I
discovered that a correct namespace changes everything: with the namespace
added, loading of my package drops to circa 1 sec, which is more that three
times faster than in R 1.9.1 without lazy loading,... and about 30 times
faster than without the namespace in R 2.0.0!

First of all, congratulation for implementing lazy loading!

Second, I look in the documentation, and in the Brian Ripley's article in R
News 2/2004, and I found nowhere a place where the importance of namespace
is stressed for lazy loading (although Brian Ripley explains in several
places differences in lazy loading with and without namespace). I think it
is something important and, unless I miss it in the documentation, it would
be useful to tell somewhere that a namespace is strongly recommended in
conjonction with lazy loading...

Finally, a question:
>From R News 2/2004 p. 30: "a 'Imports:' field for packages whose namespaces
are used but do not need to be attached." OK, functions in these namespaces
are available to me, without attaching the package. Now, if I need to attach
these packages at a later time because I will use some of their functions
from the command line, then, is this package referred twice (once in my
package environment, once attached to the search path)? If yes, what is the
drawback in term of ressources and speed ('Imports' versus 'Depends', both
in loading, and in use of such a package)?

Best,

Philippe Grosjean

..............................................<?}))><........
 ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Pentagone
( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
 ) ) ) ) )   6, av du Champ de Mars, 7000 Mons, Belgium  
( ( ( ( (       
 ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
( ( ( ( (    email: Philippe.Grosjean@umh.ac.be
 ) ) ) ) )      
( ( ( ( (    web:   http://www.umh.ac.be/~econum
 ) ) ) ) )
..............................................................


[Rd] Lazy loading - importance of NAMESPACE
Philippe Grosjean