[R] How to speed up R program
Amos B. Elberg
amos.elberg at gmail.com
Mon Mar 14 23:15:06 CET 2016
There's no way for anyone to be sure without looking directly at the code. As Jim said, the prime suspect is inefficient use of memory and excessive use of virtual memory.
The book "Advanced R" by Hadley Wickham has a very detailed and easy to understand section on how to benchmark and optimize R code. That is probably your best starting point. That, and watching what happens to memory consumption and vm use while your program is running.
> On Mar 14, 2016, at 5:55 PM, Ragia . <ragia11 at hotmail.com> wrote:
>
> thanks for answering
> the program is simulation it runs on data ( wish is taken from file to memory once) but it runs about 10k times and in each mad some calculations ?
>
> hope this clear the problem,
>
>
>
> Ragia
>
>
> ----------------------------------------
>> Date: Tue, 15 Mar 2016 08:45:56 +1100
>> Subject: Re: [R] How to speed up R program
>> From: drjimlemon at gmail.com
>> To: ragia11 at hotmail.com
>> CC: r-help at r-project.org
>>
>> Hi Ragia,
>> Improving the efficiency of a program usually requires detailed
>> analysis of what it is doing and how those operations can be performed
>> more rapidly. That is to say, without knowing what the program is
>> supposed to accomplish and how it is doing it now, very little help
>> can be provided. One thing you might look for is "disk-thrashing"
>> where your storage media (e.g. hard disk) is being accessed
>> continuously. This usually indicates that the program is swapping out
>> data to the disk, which is typically slow compared to processing it in
>> memory.
>>
>> Jim
>>
>>
>>> On Tue, Mar 15, 2016 at 8:32 AM, Ragia . <ragia11 at hotmail.com> wrote:
>>>
>>>
>>>
>>>
>>> Dear group
>>> I have two R sessions running on Ubuntu 14.0x server , and I found that my program will take too long time to be finished( months...!), I used top command and found that cpu usage is 21.3%.
>>>
>>> the server is Enterprise SP-64 - 64G E5-1630v3 SoftRaid 2x2 TB Server . 6 core
>>>
>>> how can I speed the program, kindly I need tutorial or book chapter that helps..
>>> thanks in advance
>>> Ragia
>>>
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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