R-alpha: Speed of R vs. S-plus .. some "insignificant" benchmarks:

Martin Maechler (maechler@stat.math.ethz.ch)
Fri, 12 Apr 96 15:12:26 +0200


Date: Fri, 12 Apr 96 15:12:26 +0200
Message-Id: <9604121312.AA01891@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: Speed of R vs. S-plus .. some "insignificant" benchmarks:

With R-0.4 [which defines proc.time()
	    which for me works on  SunOS, Solaris and Linux]
and my recently posted  function  unix.time(.)

you can start "benchmarking"  R vs. Splus.

I've only done very few experiments, 
	[ and I am still looking for an example
	 where Splus is getting terribly slow because of memory allocation, and
	 R is being much faster ]

What I just did is the following:
Recompile R on our Sparc Ultra 1 (our "compute server") [Solaris 2.5]
using
	CFLAGS = -O
	FFLAGS = -O3
i.e optimizing for execution speed.

The result is quite promising:

R 0.4 (optimized -O) 

> unix.time(for(i in 1:100) x <- mean(rt(1000, df=4)))
[1] 1.40 0.00 2.84 0.00 0.00
> unix.time(for(i in 1:100) x <- mean(rt(1000, df=4)))
[1] 1.40 0.00 2.56 0.00 0.00
> unix.time(for(i in 1:100) x <- mean(rt(1000, df=4)))
[1] 1.4 0.0 2.6 0.0 0.0


Splus 3.3 (optimized I hope ..)

> unix.time(for(i in 1:100) x <- mean(rt(1000, df=4)))
[1] 1.61 0.01 4.00 0.00 0.00
> unix.time(for(i in 1:100) x <- mean(rt(1000, df=4)))
[1] 1.62 0.00 3.00 0.00 0.00
> unix.time(for(i in 1:100) x <- mean(rt(1000, df=4)))
[1] 1.61 0.00 3.00 0.00 0.00

> (1.61 + 1.61 + 1.62) / (3*1.4)

[1] 1.152381
	i.e.,  R is  15%  faster on a pure number crunching thing...

But then the following :

R 0.4 (optimized -O) 

> r_1:500; unix.time(for(i in seq(r)) r[i] <- mad(runif(1000)))
[1]  9.22  0.00 20.18  0.00  0.00
> r_1:500; unix.time(for(i in seq(r)) r[i] <- mad(runif(1000)))
[1]  9.22  0.00 20.71  0.00  0.00

Splus 3.3

> r_1:500; unix.time(for(i in seq(r)) r[i] <- mad(runif(1000)))
[1]  4.93  0.01 10.00  0.00  0.00
> r_1:500; unix.time(for(i in seq(r)) r[i] <- mad(runif(1000)))
[1]  4.91  0.02 10.00  0.00  0.00

and  Splus is  87 % faster ... [it's the primarily 'mad' where it is faster...].
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-