v.demartino2@virgilio.it
2005-Jun-03 16:07 UTC
[R] Problems of performance between linux and freebsd
Dear All, I posted the following message to the Freebsd-questions mailing ================================================================<snip> On my laptop I've being using linux for some years now and "landed" at last to the gentoo distribution which I tuned for working with the statistical software R and the bunch of TeX programs such as latex, pdflatex, context and the likes (this absorb 95% of my activity on the linux box). The main action I took with gentoo was to compile everything from scratch for my pc hardware, limiting the use of X & kde using all the above mentioned software prevailingly in a simple console. Now in a partition of the same laptop I installed freebsd 5.4, set softupdates, dma=1, and the same pieces of software as those I had installed under linux using the ports, therefore, compiling everything for my pc hardware, but, owing to my poor knowledge of Freebsd I'm experiencing some problems. In a nutshell I prepared the following test files: 1) a ConTeXt file full of long (useless) chapters and pictures to run with texexec; 2) An R program which reads a long text file, puts the data in dataframes, then loops to accomplish many repetitive mathematical calculations. Now running the test files in a console linux turns out to be roughly 20-25% fast er than freebsd. Particulary slow results the loop phase of the R source code that while running slows down and seems to clog in the end. The slowing down is also perceptible under linux but not at the same level. Admiring the "ordered and unitary layout" of freebsd, the logical way of setting it up, the richness of applications, I would like to line the freebsd installation up to the linux one, improving its performance at most, not necessarily making it faster than linux. How could I obtain those improvements? What could I do to speed those programs under freebsd? </snip> Now I can be more precise about R. i) I downloaded the tarball of R 2.0.1 from CRAN; ii) I compiled the **same source *** source by means of ./configure, make, make install both on gentoo and on freebsd which share the same make.conf to optimize for a pentium4 and -O2 flag. iii) I created 2 R test programs one (simula.r) as described above at point 2) and the other (test.R) using the previous and adding some moreR code usin the library nnet and looping desperately with it (see attached files). simula.r takes 29 sec to be executed under win xp, 25 sec under linux gentoo and 26 under freebsd 5.4, all comparable. On the contrary the program test.R takes 93 sec under win xp, 85 sec under linux gentoo and an unbelievable 165 sec under freebsd. What I noticed is that test.R produces a lot of output while looping the nnet section of the program which under win xp you can only see at end of the run, under a gentoo text-console flows happily & briskly on the screen whilst under a freebsd text-console it starts happily, slows down in the middle of the looping process and clogs in the end. In a nutshell freebsd takes twice as much the time of the other 2 OSs to execute the program. Sorry for my being so detailed. What shall I do? Vittorio
> From: v.demartino2 at virgilio.it > > Dear All, > I posted the following message to the Freebsd-questions mailing > ================================================================> <snip> > On my laptop I've being using linux for some years now and > "landed" at last > to > the gentoo distribution which I tuned for working with the > statistical > software R and the bunch of TeX programs such as latex, > pdflatex, context > and > the likes (this absorb 95% of my activity on the linux box). > The main action I took with gentoo was to compile everything > from scratch > for > my pc hardware, limiting the use of X & kde using all the > above mentioned > > software prevailingly in a simple console. > > Now in a partition of the same laptop I installed freebsd 5.4, set > softupdates, dma=1, and the same pieces of software as those > I had installed > > under linux using the ports, therefore, compiling everything > for my pc > hardware, but, owing to my poor knowledge of Freebsd I'm > experiencing some > > problems. > > In a nutshell I prepared the following test files: > > 1) a ConTeXt file full of long (useless) chapters and > pictures to run with > > texexec; > 2) An R program which reads a long text file, puts the data > in dataframes, > > then loops to accomplish many repetitive mathematical calculations. > > Now running the test files in a console linux turns out to > be roughly 20-25% > > fast > er than freebsd. Particulary slow results the loop phase of > the R source > > code that while running slows down and seems to clog in the > end. The slowing > > down is also perceptible under linux but not at the same level. > > Admiring the "ordered and unitary layout" of freebsd, the > logical way of > > setting it up, the richness of applications, I would like to > line the > freebsd installation up to the linux one, improving its > performance at most, > > not necessarily making it faster than linux. > > How could I obtain those improvements? What could I do to > speed those programs > > under freebsd? > > </snip> > > Now I can be more precise about R. > i) I downloaded the tarball of R 2.0.1 from CRAN; > ii) I compiled the **same source *** source by means of > ./configure, make, > make install both on gentoo and on freebsd which share the > same make.conf > to optimize for a pentium4 and -O2 flag. > iii) I created 2 R test programs one (simula.r) as described > above at point > 2) and the other (test.R) using the previous and adding some > moreR code > usin the library nnet and looping desperately with it (see > attached files). > > simula.r takes 29 sec to be executed under win xp, 25 sec > under linux gentoo > and 26 under freebsd 5.4, all comparable. On the contrary the > program test.R > takes 93 sec under win xp, 85 sec under linux gentoo and an > unbelievable > 165 sec under freebsd. > What I noticed is that test.R produces a lot of output while > looping the > nnet section of the program which under win xp you can only > see at end of > the run, under a gentoo text-console flows happily & briskly > on the screen > whilst under a freebsd text-console it starts happily, slows > down in the > middle of the looping process and clogs in the end. In a > nutshell freebsd > takes twice as much the time of the other 2 OSs to execute > the program. > Sorry for my being so detailed. > What shall I do? > VittorioI'm no expert (not even amateur) in these matters... Anyway, under Windows R(gui) buffers its console output by default, so you don't see the output until the execution is finished (or the output exceeds the buffer size). I have no idea how konsole (I assume that's what you're using in Linux) or whatever you're using in freeBSD does. What would the numbers be if you run the R script via R CMD BATCH? Supposedly that comparison would eliminate the differences in how console outputs are buffered (or not). Andy> > > > > >