[R] efficient code. how to reduce running time?

Charilaos Skiadas skiadas at hanover.edu
Mon Jan 22 18:08:03 CET 2007

On Jan 22, 2007, at 10:39 AM, John Fox wrote:

>  One thing that seems particularly
> striking in your results is the large difference between elapsed  
> time and
> user CPU time, making me wonder what else was going on when you ran  
> these
> examples.

Yes, indeed there were a lot of other things going on, this is the  
only machine I have and I use it continuously. I'll try to run  
another test tonight when the machine is not in use.
It did seem a very striking difference though.

But am I wrong in thinking that these measurements should be  
independent of what other applications are running at the same time,  
and should measure exactly the time in terms of CPU cycles needed to  
finish this task, regardless of how often the process got to use the  
CPU? I guess I was working under that assumption, which indeed makes  
the above comparison a very unfair one, because there was a lot more  
going on during the first system.time call.

Still, the difference is quite large, which of course could simply  
have to do with the internals of the two commands, coupled with Prof.  
Ripley's comments about malloc in Mac OS X.

> Regards,
>  John


More information about the R-help mailing list