Hi, all.

I began to migrate my R codes from Windows to Linux and surprised me
with an old question. I simplified the problem and made a little test to 
compare times at same
computer and the Linux time is worse (not so little) than Windows time:
28 vs 53 seconds.

I make an example (below) to facilitate all to see the difference.
I also build from source (it's my first time) a version of R to compare with 
the distributed (compiled) R version. The times are similar to the other Linux 
version.

I supposed R on Linux should be faster (32 and 64 bit) than windows version. Is 
this difference because 64 bit R version is slower than 32 bits one? I started 
the machine in both sittuations and checked free memory.

Tecnichal details:
Machine: Intel Core 2 Duo DDR2 4 Gb RAM
Windows version: XP Professional - 32 bits
R version: 2.9* binaries
Linux version: Ubuntu 8* (Hardy) - 64 bits
R version: 2.9* binaries and 2.9* compiled from source

Thanks to all,
Cezar Freitas

 #code
 N = 50000
 n = 15000
 
 #makes data
 dad = as.data.frame(cbind(sample(N,N,replace=FALSE), rpois(N,30)))
 names(dad) = c("id","age")
 
 aux = as.data.frame(cbind(sample(N,n,replace=FALSE), round(runif(n),4)))
 names(aux) = c("id","score")
 
 #calculates time
 set.seed(790) #to be equal to everyone
 system.time({
   dad$score = 0
   subdad = subset(dad, id%in%aux$id)
   for(k in 1:(dim(subdad)[1])){
     temp = aux$score[aux$id==subdad$id[k]]
     if(length(temp)) subdad$score[k] = temp
   }
 })
 
 #windows time
 #   user  system elapsed
 #  27.81    0.00   27.82
 
 #linux usual compilation time
 #   user  system elapsed
 # 52.635   0.016  52.748
 
 #linux (my compilation) time
 #   user  system elapsed
 # 52.567   0.016  52.588
 #==============END OF CODE




      
____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to