R-alpha: Using autoload and smaller 'base' package
Thomas Lumley
thomas@biostat.washington.edu
Wed, 29 Oct 1997 12:56:15 -0800 (PST)
On Wed, 29 Oct 1997, Paul Gilbert wrote:
> If I understand this correctly, the whole package gets autoloaded the
> first time any function in the package is referenced (and then never
> unloaded until q()?).
Yes, though you can explicitly unload a package with
detach("package:package")
and it will still be reloaded automatically when needed.
> Would it be possible/logical/easy to make autoload work on a function
> by function basis? (Sounds a bit like an S .Data directory.) Is there a
> limit on how many packages can be autoloaded?
>
Possible and easy, but not logical:
There's no strict limit to the number of packages, but the overhead goes
up sharply as the packages get smaller. For the current sorts of package
the overhead would be trivial, but for one-function packages it would be
quite large. Increasing the number of packages loaded also slows a lot of
things down, as the search path gets longer and longer.
There is also some overhead on opening files, so loading lots of little
packages is slower than loading one big package.
I think autoload() is only worthwhile on largish, coherent blocks,
especially in its current interpreted form. Anything more ambitious would
probably require delving into the internal C code that finds and evaluates
things, and considering horrible things like caching and buffering for
disk access.
-thomas
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=