[R] (performance) time in Windows vs Linux
Zeljko Vrba
zvrba at ifi.uio.no
Tue Jun 30 08:00:49 CEST 2009
On Tue, Jun 30, 2009 at 10:20:17AM +0900, Raymond Wan wrote:
>
> I. Soumpasis wrote:
> >2009/6/29 C騷ar Freitas <cafanselmo12 at yahoo.com.br>
> >This is true. So I tried the same computer with windows XP and ubuntu 8.10
> >64bit dual core @3Gz and 4MB RAM
> >Windows 32bit results:
> > user system elapsed
> > 21.66 0.02 21.69
> >Linux 64bit Results
> > user system elapsed
> > 27.242 0.004 27.275
> >
> >This difference is small and it is truly explained by what the advanced
> >users have said.
>
>
> One minor comment which I forgot to mention is that a difference of 6
> seconds for system that ran 30 seconds is worth noting, but may not be
> statistically significant. Especially when we're now talking about two
> completely different OS' and, thus, two different ways of timing a
> program. If whatever data file you are using is also on a different
> file system, then one could be fragmented, etc.
>
Using wall-clock time metric is not "two different ways" of timing. He could
have just as well measured the time using stop-watch, and the results would be
equally valid (given that his reaction time is ~0.5 seconds :-)) Also, "user"
time is time just spent in executing instructions in user-mode, which does
*not* account for waiting on disk I/O. "system" time is time spent just in the
OS kernel, and that number would be also higher if there were intensive I/O
going on. If I/O pauses were to blame (fragmentation, as you suggest, does
increase latency of serving disk requests), there would be a lot of idle time,
which would be manifested in a large difference between user+system and elapsed
(the latter being wall-clock time).
The numbers displayed above suggest that Windows version performs a *lot* less
work[*] than Linux version (6 seconds of CPU time is a *lot* of work given
today's CPU frequencies).
[*] All programs actually run equally fast on a given machine, but some finish
the same task sooner because they are doing less work...
The answer can actually be obtained by compiling R with profiling enabled; this
will slow down execution considerably, but one will be able to pinpoint major
differences in performance. Wild speculations about sources of this difference:
1) whatever compiler produced the Windows binary has better optimizations,
2) R heavily uses some standard library routines (within system-provided DLLs)
that are better optimized under Windows than under Linux.
More information about the R-help
mailing list