[R] Generate temporary objects or not?

Mark Myatt mark at myatt.demon.co.uk
Wed Feb 28 10:57:25 CET 2001



>There are two fundamental principles of optimisation
>1) Don't do it unless you need it
>2) Measure, don't guess, about speed.

I'd go along with that. Using temporary objects has the advantage of
readability (if you use descriptive object names) when you come back to
code several months later. It is scant comfort that you saved two hours
on a run of an unattended simulation last year when you are toiling over
a soup of $[][[]](((()))){}{}s trying to reconstruct last years
thinking. One thing I do is to write code for readability, test it for a
while and debug before optimising. I then have a readable version that
works should I ever need it. Of course there is always '#'.


Mark Myatt

r-help 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-help-request at stat.math.ethz.ch

More information about the R-help mailing list