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
______________________________________________
R-help@r-project.org 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.