A few things to add to what Spencer said: - Please give more info about your setup, as the posting guide asks you to (e.g., R version, OS [which Linux distro and which release?], hardware). These things matter! As an example, the time it takes to start an R process was dramatically reduced since R-2.0.0. If you are using older version, you need to upgrade.
- See the example section of ?Startup, which has an example of how to specify packages to be loaded at startup. - There's a section on profiling R code in the `Writing R Extensions' manual, that may help you pinpoint the bottleneck. - Sometimes re-thinking the organization of the computation or algorithm can make a huge difference. I remember reading in an old computing book the staggering difference between FFT and doing the computation the naïve way. Andy > From: Spencer Graves > > My standard algorithm for improving speed is as follows: > > 1. Identify what takes the most time. > > 2. Try to find ways in R to speed it up, e.g., > converting loops > to vector operations. Many tasks in R can be performed in a > variety of > different ways to get the same result but with different time. > > 3. If that fails, convert the most time consuming part into > compiled code and link to it. > > Use "system.time" to time a single expression and > "proc.time" to > store the time at multiple places in your code; precede any > test with > garbage collection (gc) to reduce variations in the answers. > > An "R site search" (www.r-project.org -> Search -> "R site > search") for "timing R" produced 126 hits, the second of which gave > "system.time"; you might skim the rest for other ideas. A similar > search for "compute speed" produced 64 hits, some of which will > doubtless interest you if you haven't already read them. > > For more help on this, please be more specific, e.g., following > the posting guide! "http://www.R-project.org/posting-guide.html". > > hope this helps. spencer graves > > ebashi wrote: > > >Dear R users; > >I am using R for a project. I have some PHP forms that > >pass parameters to R for calculations, and publish the > >result in HTML format by CGIwithR. I'm using a Linux > >machine and every things work perfectly. However, it > >is too slow, it takes 5 to 10 seconds to run, and > >even if I start R from the Shell it takes the same > >amount of time, which is probably due to installing > >packages. My first question is that how can i make R > >run faster? and second if I am supposed to reduce the > >packages which are being loaded at initiation of R, > >how can I limit it to only the packages that i want? > >and third how can i make R not to get open each time, > >and let it sit on the server so that, when i pass > >something to it , i get result faster? > > > >Sincerely, > >Sean > > > >______________________________________________ > >R-help@stat.math.ethz.ch mailing list > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > > > > > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html