User and System are a measure of the CPU time that was consumed.  Elapsed
time is the "wall clock" and even though they are both measured in seconds,
they are not really the same units.  The reason for the difference is any
"idle" time that they system may have waiting for I/O to complete which does
not consume CPU time for your process, but does consume Elasped time.

For some instances of CPU intensive code (with no I/O of competing tasks),
the User + System ~= Elapsed.  Also you have to take into account the
granularity of the clock when looking at numbers like 0.04.  So serious
comparisons of timing, you want runs of at least 10s of seconds or more.


On 7/4/07, Stefan Grosse <singularitaet@gmx.net> wrote:
>
> Gabor Grothendieck wrote:
> >> set.seed(1)
> >> C <- sample(c("a", "b"), 100000, replace = TRUE)
> >> system.time(s1 <- ifelse(C == "a", 1, -1))
> >>
> >    user  system elapsed
> >    0.37    0.01    0.38
> >
> >> system.time(s2 <- 2 * (C == "a") - 1)
> >>
> >    user  system elapsed
> >    0.02    0.00    0.02
> >
> > system.time(s1 <- ifelse(C == "a", 1, -1))
>   user  system elapsed
>   0.04    0.01    0.08
> > system.time(s2 <- 2 * (C == "a") - 1)
>   user  system elapsed
>      0       0       0
>
>
> I am just wondering: how comes the time does add up to 0.05 while
> elapsed states 0.08 on my system? (Vista+R2.5.1)
>
> Stefan
>
>
> -=-=-
> ... Time is an illusion, lunchtime doubly so. (Ford Prefect)
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

