[Rd] Speeding up library loading

Ali - saveez at hotmail.com
Tue Apr 26 08:46:03 CEST 2005



>>
>>Assume 100 C++ classes each class having 100 member functions. After 
>>wrapping these classes into R, if the wrapping design is class-oriented we 
>>should have like 100 objects. At the same time, if the wrapping design is 
>>function-oriented we have like 10`000 objects which are too lazy for lazy 
>>loading.
>>
>>I have tried wrapping exactly the same classes by R.oo based on S3 and the 
>>outcome package was much faster in both installation and loading. The 
>>package went slow once I tried it with S4. I guess R.oo makes the package 
>>more class-oriented while S4 object-orientation is really 
>>function-oriented causing all this friction in installation and loading.
>>
>>Is there any way to ask R to lazy-load each object as a 'bundle of S4 
>>methods with the same class'?
>
>I don't think so.  There are ways to load a bundle of objects all at once 
>(put them in an environment, attach the environment), but S4 methods aren't 
>self-contained, they need to be registered with the system.   You could 
>probably write a function to load them and register them all at once, but I 
>don't think it exists now.
>
>Duncan Murdoch

(1) What is the difference between loading and registering objects in R?

(2) You are talking about 'loading and registering at once'. Isn't this 'at 
once' the cause of slow loading?

(3) Doesn't having many environments mean lose of efficiency again?



More information about the R-devel mailing list