From ihaka@stat.auckland.ac.nz  Mon Nov 10 20:00:55 1997
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Tue, 11 Nov 1997 09:00:55 +1300 (NZDT)
Subject: R-alpha: loop speed
Message-ID: <199711102000.JAA20068@stat1.stat.auckland.ac.nz>

	From r-devel-owner@stat.math.ethz.ch Tue Nov 11 05:58 NZD 1997
	Date: Mon, 10 Nov 1997 11:56:06 -0500
	From: Paul Gilbert <pgilbert@bank-banque-canada.ca>

	 S> unix.time(res1 <-
	cbind(x*y,x-y,x+y,x/y)[cbind(seq(along=x),match(op,c("*", "-", "+",
	"/")))])
	 [1] 0.40000010 0.04999995 0.00000000 0.00000000 0.00000000

	 R> unix.time(res1 <-
	cbind(x*y,x-y,x+y,x/y)[cbind(seq(along=x),match(op,c("*", "-", "+",
	"/")))])
	 [1] 1.55 0.07 2.00 0.00 0.00

We have received a patch from someone in CS at Berkeley which will
be in 0.60 and should claw back a decent fraction of the difference
between R and S in this comparison.  [ It eliminates our use of the
% operator in the loops for +, -, * / etc. ]

The looping speed was an original design goal for R.  It's good to
know that it hasn't been fixed (yet).

	Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


R-alpha: loop speed
Ross Ihaka