[R] Lazy loading... advices
Martin Maechler
maechler at stat.math.ethz.ch
Sat Oct 16 21:17:22 CEST 2004
>>>>> "UweL" == Uwe Ligges <ligges at statistik.uni-dortmund.de>
>>>>> on Sat, 16 Oct 2004 18:31:29 +0200 writes:
UweL> Philippe Grosjean wrote:
>> Hello,
>>
>> I am looking for more information about lazy loading
>> introduced in R 2.0.0. Doing ?lazyLoad I got some and
>> there is a 'see also' section that points to
>> 'makeLazyLoading'... But I cannot reach this page.
>>
>> My problem is: I recompiled a library
UweL> Philippe,
UweL> citing Doug Bates: "Someone named Martin Maechler will
UweL> shortly be sending you email regarding the distinction
UweL> between 'library' and 'package'". ;-)
of course, now I have to ....
Note that library(<package>) attaches and loads a *package* from
one of possibly several libraries { = the directories listed,
e.g., by .libPaths() !}
>> that uses a lot of functions from other libraries (of
>> course I can give details if needed). I load it in my
>> computer: library(svGUI), and it takes something like 20
>> seconds to load. In R 1.9.1 it took 3-4 seconds on the
>> same machine (Windows XP). So, I try now to understand
>> the mechanism and to find a way to lower the loading time
>> of this library with lazy loading (its goal is to load
>> faster, isn't, so I probably do something wrong).
UweL> It might not always be faster. See Brian Ripley's
UweL> article in the most recent R Newsletter. Probably you
UweL> are using a lot of functions in the startup directly
UweL> after the call to library() (in .First.lib() or
UweL> .onLoad() or Hooks or whatever). I think you want to
UweL> specify "LazyLoad: no" in the package's DESCRIPTION
UweL> file (cp. "Writing R Extensions").
I'm pretty sure the increased startup time comes from the very
long 'Depends:' field in Philippe's package.
I'd bet that -- after reading Brian's article -- Philippe will
find that he can make the 'Depends' much smaller, e.g., by
moving entries to 'Suggests'.
Martin
More information about the R-help
mailing list