[R] Time-travelling laptop, or problem with system.time?
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sat Nov 1 19:05:03 CET 2008
Rense wrote:
> Playing around with my new laptop (Macbook, 2.4Ghz), I encountered
> unexplained timings using system.time.
>
> I did the following:
>
>> X <- Matrix(rnorm(1e6), 1000)
>> system.time(for(i in 1:25) X%*%X)
> user system elapsed
> 8.306 0.591 5.031
>> system.time(for(i in 1:25) solve(X))
> user system elapsed
> 8.933 1.331 6.684
>> system.time(for(i in 1:10) svd(X))
> user system elapsed
> 36.989 3.665 33.384
>
> From R-News I got the following description:
>
> "The returned value consists of user time (CPU time R needs for
> calculations), system time (time the system is using for processing
> requests, e.g., for handling files), total time (how long it really took to
> process the command) and — depending on the operating system in use — two
> further elements."
>
> Do I misunderstand these timings, or is my laptop indeed capable of time
> travel?
I guess you are using a CPU optimized BLAS and hence these matrix
operations can make use of more than one thread (i.e. parallel
processing). In that case, the user CPU time is the sum of the CPU time
of all used CPU cores, but elapsed means that the whole task finished
after, e.g. 5 seconds of real time while a second core helped the first
one and hence they both used CPU 8.3 seconds together (one 5 and one 3.3
seconds, for example).
Uwe Ligges
> Kind regards,
>
> Rense
>
>
>
>
More information about the R-help
mailing list