From martin.becker at mx.uni-saarland.de  Mon Aug 28 16:23:52 2006
From: martin.becker at mx.uni-saarland.de (Martin Becker)
Date: Mon, 28 Aug 2006 16:23:52 +0200
Subject: [Rd] Speed of runif() on different Operating Systems
Message-ID: <44F2FC78.3040106@mx.uni-saarland.de>

Dear list,

I have noticed surprisingly big performance differences of runif() 
between Windows XP and (Debian) linux on similar CPUs (Pentium D 3.0GHz 
(WinXP)/3.2GHz (Linux)) and I wonder if there is a simple explanation 
for the difference.
On a linux system (with a slightly better CPU and 1GB more RAM), 
execution of runif() seems to consume about 80% more CPU time than on a 
Windows XP system.
On a Xeon 2.7GHz (Debian) linux I have checked, that using the .deb - 
i386 - Version of R instead of a self-build i686 - version has no 
noticeable effect on speed.
Measuring CPU time with Rprof() instead of Sys.time()-differences yields 
similar results.

Any hint is appreciated, please let me know, if the given information on 
system/OS or the R output below is not sufficient.

Regards,

  Martin Becker

------------------------ R - Output  below ------------------------

Windows XP: (Pentium D, 3.0 GHz)

 > version
               _                        
platform       i386-pc-mingw32          
arch           i386                     
os             mingw32                  
system         i386, mingw32            
status                                  
major          2                        
minor          3.1                      
year           2006                     
month          06                       
day            01                       
svn rev        38247                    
language       R                        
version.string Version 2.3.1 (2006-06-01)
 > RNGkind()
[1] "Mersenne-Twister" "Inversion"      
 > t1<-Sys.time();for (i in 1:500) ttt<-runif(1000000);print(Sys.time()-t1);
Time difference of 57.969 secs
 >

Debian Linux: (Pentium D, 3.2GHz)

 > version
               _                        
platform       i686-pc-linux-gnu        
arch           i686                     
os             linux-gnu                
system         i686, linux-gnu          
status                                  
major          2                        
minor          3.1                      
year           2006                     
month          06                       
day            01                       
svn rev        38247                    
language       R                        
version.string Version 2.3.1 (2006-06-01)
 > RNGkind()
[1] "Mersenne-Twister" "Inversion"      
 > t1<-Sys.time();for (i in 1:500) 
ttt<-runif(1000000);print(Sys.time()-t1);    
Time difference of 1.752916 mins
 >




[Rd] Speed of runif() on different Operating Systems
Martin Becker