performance of apply
Thomas Lumley
thomas@biostat.washington.edu
Fri, 29 May 1998 09:14:36 -0700 (PDT)
On 29 May 1998, Douglas Bates wrote:
> Andreas Weingessel <Andreas.Weingessel@ci.tuwien.ac.at> writes:
>
> > I noticed that apply is VERY SLOW when applied to a "large"
> > dimension as for example when computing the row sums of a matrix with
> > thousands of rows.
> >
>
>
> We should keep in mind when looking at these tables that the maximum
> time on the size 10000 case is about 2 minutes. If the computation is
> worth doing it may be worth waiting 2 minutes for the result. I
> remember the days of running S version 2 (i.e. the version before "New
> S") on a Vax-11/750. This sort of computation could take many, many
> hours on the only computer in the department so relative differences
> in speed for different methods were a lot more important. One got
> used to rephrasing computations in "efficient" ways. Today I think
> that clarity is usually more important than efficiency.
One of the really nice things about R is that you _don't_ have to use
apply to get loops to run in reasonable time, since for most non-Lisp
people for() is simpler than apply().
Thomas Lumley
------------------------------------------------------+------
Biostatistics : "Never attribute to malice what :
Uni of Washington : can be adequately explained by :
Box 357232 : incompetence" - Hanlon's Razor :
Seattle WA 98195-7232 : :
------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._