Skip to content
Prev 205856 / 398506 Next

Reducing the size of a large script top speed onset of execution

Please just use make a package; then all the effort of parsing the 
code is done at install time, you can use lazy-loading ....  Or if you 
are for some reason averse to that, source the code into an 
environment, save that and simply attach() its save file next time.

Packages of that size load in a few milliseconds (as you see each time 
you start R:  stats is 27000 lines).

source() is doing more work to allow it to guess encodings, keeping 
references to the original sources, back out code if the whole script 
does not parse ....
On Sat, 9 Jan 2010, Dennis Fisher wrote: