[R] Calling R from a Perl script: much slower?

jim holtman jholtman at gmail.com
Thu Sep 3 19:57:27 CEST 2009

What operating system are you running under?  You should take a look
at the R process and see how much time it is using to see if there is
a difference in the CPU time.  Are you paging?  Exactly how are you
invoking the R script?  Why are you using the GUI instead of Rterm?
You might try to run Rprof on the code to see if there are
differences.  Are you sure you are running exactly the same data in
both cases?

On Thu, Sep 3, 2009 at 11:42 AM, <J.delasHeras at ed.ac.uk> wrote:
> Hello list,
> I use R for microarray analysis.
> One procedure I use takes a large matrix, and loops through it looking for
> specific rows, does an operation with them, and outputs a result (single
> row) as a row of another matrix. The loop goes on about 25000 times.
> When I run the loop directly from the R console itself, it takes about 3
> minutes in my computer. I'm ok with that.
> Now, when that same code is ran from within a GUI we created using Perl
> (Tcl/Tkx) it's taking 25-30 minutes to run.
> Within the R code I inserted a line so that it writes a little file every
> 1000th iteration of the loop, so that I can follow the progress. I don't
> understand why it takes 10x longer when ran from Perl.
> I am not new to R, but I am new to using it within Perl or any other
> language. Is there a way to improve performance? What is the reason for the
> slower speed?
> I'll happily provide the code if somebody wants it.
> thank you.
> Jose
> --
> Dr. Jose I. de las Heras                      Email: J.delasHeras at ed.ac.uk
> The Wellcome Trust Centre for Cell Biology    Phone: +44 (0)131 6513374
> Institute for Cell & Molecular Biology        Fax:   +44 (0)131 6507360
> Swann Building, Mayfield Road
> University of Edinburgh
> Edinburgh EH9 3JR
> UK
> *********************************************
> NEW EMAIL from July'09: nach.mcnach at gmail.com
> *********************************************
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> ______________________________________________
> 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.

Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

More information about the R-help mailing list