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

Romain Francois romain.francois at dbmail.com
Thu Sep 3 20:03:31 CEST 2009


On 09/03/2009 05:42 PM, 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

Can you describe what you mean by "running the code from the gui". Is R 
embedded in you application or do you create a new R session each time.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/xMdt : update on the ant package
|- http://tr.im/xHLs : R capable version of ant
`- http://tr.im/xHiZ : Tip: get java home from R with rJava




More information about the R-help mailing list