[IPython-dev] Feature request/how?
Fernando.Perez at colorado.edu
Tue Feb 22 15:32:33 CST 2005
Ville Vainio wrote:
> On Tue, 2005-02-22 at 12:05 -0700, Fernando.Perez at colorado.edu wrote:
>>This is expected: the code I gave you uses genutils.clock(), which is written
>>(at least on Unix) to report only true CPU time. A sleep() call doesn't
>>consume almost any cpu time at all. Feel free to make a modified version of
>>this function which uses other timing routines from the time module if you want
>>wall clock time. As far as I'm concerned, reporting wall clock time is in most
>>cases a bug, since it's completely context dependent. But there are valid
>>cases for wanting it, so you could for example add a -w switch to this function
>>to use a wall clock instead.
> I'd be tempted to think that wall clock time should be the default.
> Isn't CPU time quite arbitrary measurement if the problem is I/O bound?
> timeit module also measures wallclock time (using time.time() on posix).
> Knowing the wallclock time is also necessary to see whether the solution
> under experimentation will fly in a real application. It's hard to get
> an intuitive grasp from CPU time.
Well, I guess we just come from different backgrounds. For me, cpu time is
pretty much the only relevant number 99% of the time, but that's because I
work in scientific computing problems which are not I/O bound. For others,
wall time may be what matters (I said as much above: "As far as I'm concerned,
reporting wall clock time is in most cases a bug", note the _I_ in that quote).
I am unfortunately completely swamped right now, and can't afford to write a
nice, generic, flexible timing magic which can address all valid usage cases.
If anyone volunteers a patch, I'll gladly include it (it's not hard).
Otherwise, the basic, cpu-bound %time I wrote stays. As is, it will be quite
useful to scientific computing types (my most significant target market).
More information about the IPython-dev