[R] (performance) time in Windows vs Linux
Uwe Ligges
ligges at statistik.tu-dortmund.de
Fri Jun 26 22:40:26 CEST 2009
Yes, under 64-bit it is sometimes slower and it highly depends on the
problem and the compiler you have. Note also that nobody managed to get
a 64-bit Windows R binary compiled with gcc so far.
Remember, 10 years ago there was the SUN Ultra Sparc III and above
architecture, and gcc was known to produce extremely inefficient 64-bit
binaries for that platform. Things got somewhat better in the meantime.
With the tests I used 32-bit R compiled with gcc was roughly 10% slower
on Windows than under Linux - but as I said, it depends on the problem.
Trying loops versus matrix operations is a way to specify a two very
different problems, for example.
Uwe Ligges
Cézar Freitas wrote:
> 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 at 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.
More information about the R-help
mailing list