From saveez at hotmail.com  Mon Apr 25 23:05:15 2005
From: saveez at hotmail.com (Ali -)
Date: Mon Apr 25 23:05:24 2005
Subject: [Rd] Speeding up library loading
In-Reply-To: <Pine.A41.4.61b.0504251314110.36074@homer03.u.washington.edu>
Message-ID: <BAY17-F11AA791A3E71A75A6F785BD1200@phx.gbl>



>>Lazy loading just converts an object into a small instruction to load the 
>>object. If the object was already small, there's no advantage to that.  
>>It's mainly designed to avoid memory use (some rarely used objects can be 
>>gigantic).
>
>From a design point of view the reason is that this isn't the problem lazy 
>loading is trying to solve. We didn't have a problem with packages that 
>have huge number of small objects, but we did have a problem with packages 
>that had a moderate number of moderately large objects.
>
>In addition, trying to optimize performance is not usually a good idea 
>unless you can measure the performance of different implementations on real 
>applications, and we didn't have applications like that.

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'?


[Rd] Speeding up library loading
Ali -